Skip to content

Commit e47a0f3

Browse files
committed
Fix the CRD path for integration tests
Use a glob instead of hard coding a path to a specific version.
1 parent c079f68 commit e47a0f3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

controllers/suite_test.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,18 @@ var _ = BeforeSuite(func() {
9898
ctx, cancel = context.WithCancel(ctrl.SetupSignalHandler())
9999

100100
By("bootstrapping test environment")
101+
operatorCrdsGlob := fmt.Sprintf(
102+
"%s/%s",
103+
build.Default.GOPATH,
104+
"pkg/mod/github.com/rabbitmq/cluster-operator/*/config/crd/bases",
105+
)
106+
operatorCrds, err := filepath.Glob(operatorCrdsGlob)
107+
Expect(err).ToNot(HaveOccurred())
108+
Expect(operatorCrds).ToNot(BeEmpty())
109+
110+
operatorCrds = append(operatorCrds, filepath.Join("..", "config", "crd", "bases"))
101111
testEnv = &envtest.Environment{
102-
CRDDirectoryPaths: []string{
103-
filepath.Join("..", "config", "crd", "bases"),
104-
filepath.Join(build.Default.GOPATH, "pkg", "mod", "github.com", "rabbitmq", "cluster-operator", "[email protected]", "config", "crd", "bases"),
105-
},
112+
CRDDirectoryPaths: operatorCrds,
106113
ErrorIfCRDPathMissing: true,
107114
Config: &rest.Config{
108115
Host: fmt.Sprintf("localhost:818%d", GinkgoParallelProcess()),

0 commit comments

Comments
 (0)