-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱Export conditions.HasSameState method #11253
Conversation
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.
general +1, but if this is done i would also mark HaveSameStateOf as deprecated and remove it on the next minor release. there are no rules around that, but i'm not a fan of importing goomega/* code in non _test.go files or in non-test dedicated util packages.
me too, that's why it is created, but it looks like HaveSameStateOf is used solely in tests of the library as a matcher and does the same job as |
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
/assign @fabriziopandini @sbueringer
LGTM label has been added. Git tree hash: ee5fe662a86f3d98a24df1844090e4e0480c1bbc
|
If using patch helper, it does already this for you.
this is expected, HaveSameStateOf has been designed as a matcher to be used in tests.
having a matcher helps in writing test, I would Not deprecate it.
New conditions helpers recently merged, see #10997 |
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini 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 |
yes, I saw it, but was questioning when they would become the base, replacing the code I am fixing here. |
Yeah definitely fine to improve the current helpers while they are still around |
What this PR does / why we need it:
There are cases when one wants to compare existing condition and the condition to be applied before applying them, to avoid extra PATCH request to the server, but the only way to do it today is to wrap it in gomega.Matcher, like this:
In this PR I propose to export HasSameState, to simplify the code above as (I understand not a big benefit, but just not clear why should we use gomega for simple comparison
/area util
The only question is about conditions.v1beta2 - how close they are and does it make sense to improve the current code? It looks like those would not use the comparison helpers and
meta.SetStatusCondition
already returns the answer if the condition is changed.