-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
matchers: query
now ANDs multiple keys
#6054
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
matchers: query
now ANDs multiple keys
#6054
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.
Thanks for helping out with this! I wonder if it'd be a little more robust / readable if it instead checked for any that don't match?
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.
Probably need a couple more test cases to cover when there's query keys with a value that doesn't match (not only keys that don't exist in the request)
query
now ANDs multiple keys
d598054
to
9102351
Compare
@mholt I am not sure I totally get what you mean by "if it instead checked for any that don't match?". I tried to tweak the logic a little bit to make it more readable / less nested. Happy to rework it again If you still don't like it. @francislavoie I added a couple more tests around the case where the query key values do not match. Also, I am not sure why the runner failed to download the action in the setup job of the failing test 😅 |
I think I see a possible bug. What if there's two values configured for a key and both match? It would increment twice. Need a test for that. I think the fix is to add a I re-ran the failing mac build. Probably just some flaky server. |
I thought about this but since we're only checking against |
Yeah, I think so. 👍 |
9102351
to
8bd45b2
Compare
@francislavoie Any idea why some of the builds are failing to get the "slices" package? |
Slices isn't available in Go 1.20, it's new in 1.21 |
Should I then be using |
Yeah, you can use |
81eb574
to
081d509
Compare
Should be good to go now. Thanks for the help! |
Only thing is I'm not quite sure what the behaviour should be when there's multiple values provided for a query. There's an argument to be said that it should only match if there's a single matching value. But we didn't really envision this being used with multi-value query keys. Whatever we decide (what you have now is probably fine), we'll need to document clearly the way it behaves. We should adjust the Edit: Oh we already document it as such:
So yeah, should be fine. |
That sounds good. Let me know if we decide to treat that case differently then and I can adjust the code accordingly! Thanks again for your review/feedback. |
081d509
to
5f5279d
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, thanks for working on this!
Closes #6053
@francislavoie please let me know if you would rather solve the issue some other way. Thanks!