-
Notifications
You must be signed in to change notification settings - Fork 62
api: add tests that ensure types and reasons are registered correctly #122
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
api: add tests that ensure types and reasons are registered correctly #122
Conversation
cb96d05
to
6e9c763
Compare
}) | ||
}) | ||
|
||
func parseConstants(prefix string) ([]string, error) { |
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.
nice! could be cool to add a couple of comments for those unfamiliar with the the ast package
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.
👨🍳 💋
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 - just one small non-blocking suggestion
@joelanford could you please rebase? |
Signed-off-by: Joe Lanford <[email protected]>
6e9c763
to
79ad2c8
Compare
Done! Thanks for the review @perdasilva! |
…operator-framework#122) Signed-off-by: Joe Lanford <[email protected]> Signed-off-by: perdasilva <[email protected]>
…operator-framework#122) Signed-off-by: Joe Lanford <[email protected]> Signed-off-by: perdasilva <[email protected]>
Fix link and misspelling The operator-controller docs link was 404ing, now it links to the correct folder. Signed-off-by: Justin Kulikauskas <[email protected]>
We currently export constants for the universe of types and reasons that the operator controller uses to set conditions. And we append them to a list that is used in reconciler tests to ensure that
Reconcile
sets each condition type during any given call. See here.However there's still a small gap. It's possible to add a new type/reason without appending it into the respective operatorutil list, which means the assumptions we make (i.e. that the operatorutil lists are exhaustive) are not enforced. And that means our invariant test for "all types must be set at the end of a reconcile call" might produce false negatives.
This PR closes that gap by adding a test that ensures that:
Type
orReason
, its value exists in the respective operatorutil slice.Type
orReason
prefixed constant.