Skip to content

Commit 985cc70

Browse files
Fix test helper to allow multiple test environments
1 parent 967fa2f commit 985cc70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/helpers/envtest.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ func newTestEnvironment() *TestEnvironment {
5656
_, filename, _, _ := goruntime.Caller(0) //nolint
5757
root := path.Join(path.Dir(filename), "..", "..")
5858

59+
// Every time a CRD are created, ResourceVersion is set and this will prevent creation of
60+
// subsequent test environments; so we are enforcing empty ResourceVersion to make it is possible
61+
// to create more TestEnvironments.
62+
external.TestGenericBootstrapCRD.SetResourceVersion("")
63+
external.TestGenericBootstrapTemplateCRD.SetResourceVersion("")
64+
external.TestGenericInfrastructureCRD.SetResourceVersion("")
65+
external.TestGenericInfrastructureTemplateCRD.SetResourceVersion("")
66+
5967
return &TestEnvironment{
6068
Environment: &envtest.Environment{
6169
ErrorIfCRDPathMissing: true,

0 commit comments

Comments
 (0)