-
Notifications
You must be signed in to change notification settings - Fork 1.2k
:sparkles Add env support for setting ErrorIfCRDPathMissing during testing #511
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,10 +58,28 @@ var _ = Describe("Test", func() { | |
}) | ||
|
||
Describe("InstallCRDs", func() { | ||
|
||
It("should set ErrorIfCRDPathMissing through env settings", func(done Done) { | ||
|
||
testEnv := &Environment{ | ||
ErrorIfCRDPathMissing: true, | ||
} | ||
|
||
crds, err = InstallCRDs(env.Config, CRDInstallOptions{ | ||
Paths: []string{"fake"}, | ||
ErrorIfPathMissing: testEnv.ErrorIfCRDPathMissing, | ||
}) | ||
|
||
Expect(err).To(HaveOccurred()) | ||
|
||
close(done) | ||
}) | ||
|
||
It("should install the CRDs into the cluster", func(done Done) { | ||
|
||
crds, err = InstallCRDs(env.Config, CRDInstallOptions{ | ||
Paths: []string{filepath.Join(".", "testdata")}, | ||
Paths: []string{filepath.Join(".", "testdata")}, | ||
ErrorIfPathMissing: env.ErrorIfCRDPathMissing, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DirectXMan12 to your first point, although the change is minimal, I did make use of the new option here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, but it's not plumbed through to any non-test logic, afaict |
||
}) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's unclear to me what this is testing, since it doesn't seem to be testing that the setting gets automatically propogated from
Environment
toInstallCRDs
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it only validates the new option. This was to keep the other tests unchanged here.
https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/envtest/envtest_test.go#L155
My other thought was to make this change directly in BeforeSuite and update all the tests accordingly.
Any opposition to this?