Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check-in testdata such that test can be run in IDE/ using go without using Makefile #482

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions make/test-integration.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

trust_manager_crds := $(bin_dir)/scratch/trust.cert-manager.io_bundles.yaml
$(trust_manager_crds): $(helm_chart_archive) | $(NEEDS_HELM) $(NEEDS_YQ)
trust_manager_crds := test/testdata/trust.cert-manager.io_bundles.yaml

generate-testdata: $(helm_chart_archive) | $(NEEDS_HELM) $(NEEDS_YQ)
$(HELM) template test "$(helm_chart_archive)" | \
$(YQ) e '. | select(.kind == "CustomResourceDefinition")' \
> $@
$(YQ) e '. | select(.kind == "CustomResourceDefinition") | del(.metadata.labels)' \
> $(CURDIR)/$(trust_manager_crds)

shared_generate_targets += generate-testdata

.PHONY: test-integration
## Integration tests
## @category Testing
test-integration: | $(trust_manager_crds) $(NEEDS_GOTESTSUM) $(NEEDS_ETCD) $(NEEDS_KUBE-APISERVER) $(NEEDS_KUBECTL) $(ARTIFACTS)
TRUST_MANAGER_CRDS=$(CURDIR)/$(trust_manager_crds) \
KUBEBUILDER_ASSETS=$(CURDIR)/$(bin_dir)/tools \
$(GOTESTSUM) \
--junitfile=$(ARTIFACTS)/junit-go-e2e.xml \
Expand Down
9 changes: 3 additions & 6 deletions test/integration/bundle/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package test

import (
"os"

"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand All @@ -30,20 +28,19 @@ import (
. "github.com/onsi/gomega"
)

const crdsYAMLFile = "../../testdata/trust.cert-manager.io_bundles.yaml"

var (
env *envtest.Environment
)

var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

crdsYamlFile := os.Getenv("TRUST_MANAGER_CRDS")
Expect(crdsYamlFile).NotTo(BeEmpty(), "TRUST_MANAGER_CRDS must be set to the path of the CRDs to install")

env = &envtest.Environment{
UseExistingCluster: ptr.To(false),
CRDDirectoryPaths: []string{
crdsYamlFile,
crdsYAMLFile,
},
Scheme: trustapi.GlobalScheme,
}
Expand Down
Loading