-
Notifications
You must be signed in to change notification settings - Fork 493
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
Add label filtering (-l) for get commands #2892
Add label filtering (-l) for get commands #2892
Conversation
Welcome @yeedove! |
Hi @yeedove. 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/test-infra repository. |
/assign |
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.
Thanks @yeedove! This is neat :)
One minor request, can we please have consistent names of the test functions (like TestHTTPRoutesPrinter_LabelSelector) and add a small comment before the test function describing that this is focused only on checking if label based filtering is working fine.
@@ -364,3 +365,181 @@ EffectivePolicies: | |||
t.Errorf("Unexpected diff\ngot=\n%v\nwant=\n%v\ndiff (-want +got)=\n%v", got, want, diff) | |||
} | |||
} | |||
|
|||
func TestGatewaysPrinter_LabelSelector(t *testing.T) { |
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.
This suggestions applies to the rest of the test functions as well.
Lets aim to be very focused on the piece of functionality this function is testing. In this case, since we're mostly concerned with the fact that label based filtering is working, we can try and reduce some of the other pieces of the test. For example:
- Maybe lets have only one GatewayClass. All gateways can be for the same GatewayClass.
- Lets create a helper function, within the test function like the following:
This function will return the exact same gateway, with only the name and labels varying.
gateway := func(name string, labels map[string]string) gatewayv1.Gateway {...}
- Within the function above, lets try to set the bare minimal set of values within the Gateway resource (of course, it need not be the strict minimal set, but whatever we can cut things down to without much trial and error)
This should really help with:
- Readers focusing on what is being tested.
- Reduce the impact of unrelated changes affecting this test function.
- Some wise people have said that code is a liability, so we should try and minimize when possible.
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.
Yup, done!
/ok-to-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauravkghildiyal, yeedove 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 |
/hold |
/label tide/merge-method-squash |
/unhold |
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #2890
Does this PR introduce a user-facing change?: