-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
✨ (deploy-image/v1alpha): Improve tests scaffolded for the controllers #4197
✨ (deploy-image/v1alpha): Improve tests scaffolded for the controllers #4197
Conversation
Hi @mogsie. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
e0e08f4
to
bbb191d
Compare
I have the possibility of rewriting that last eventually as follows:
This would improve the robustness of the test, as the test wouldn't be checking the non-computer friendly message but only the fields that constitute the API: Type, Status, Reason. It would also be testing for duplicates in the status. The trick is that The older test would ignore multiple duplicate conditions (i.e. conditions of the same type), since it only would assert that one status matched. I will add this too. |
bdb9391
to
84980cf
Compare
docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller_test.go
Show resolved
Hide resolved
84980cf
to
d629145
Compare
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.
/lgtm
/ok-to-test |
d629145
to
322e871
Compare
Fixes a weakness in the controller-test. Previously, the test did not check for duplicates. Duplicate conditions can be a problem, and this new way of writing the test ensures that this is caught early. * To(Not()) → NotTo() * Use default eventually timeouts * Eventually(func() error) → Eventually(func(g Gomega)), and then use g.Expect inside those Eventually() functions * Reconcile a second time, since the first time, it is still "unknown" * Remove use of Eventually when nothing else is happening * Use Gomega assertions for the condition check * Check for uniqueness for the conditions * Use gomega's format string support to explain the context of failures
322e871
to
618a87b
Compare
docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller_test.go
Show resolved
Hide resolved
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, mogsie, varshaprasad96 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Motivation: #4135