-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Matcher: add a "not" matcher #16149
Matcher: add a "not" matcher #16149
Conversation
Hi @aguinet, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
94763b2
to
3d7573d
Compare
@@ -81,6 +81,9 @@ message Matcher { | |||
|
|||
// A list of predicates to be AND-ed together. | |||
PredicateList and_matcher = 3; | |||
|
|||
// The invert of a predicate | |||
Predicate not_matcher = 4; |
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.
@htuch I'm not sure to fully understand your suggestion. The implementation and tests are already in this PR. Do you want them in a separate commit/PR?
Thanks!
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.
I think I didn't include it because I thought the on_no_match
mechanism would be sufficient, but to get that working in the trivial case you need a noop action to terminate the match path (since we required an on_match for each matcher), which seems like a less than ideal pattern
Looks good, @aguinet can you fix DCO? Thanks |
3d7573d
to
678e161
Compare
DCO fixed! Pushed --force |
Looks like a legitimate drop in coverage reported by CI, see https://dev.azure.com/cncf/envoy/_build/results?buildId=73473&view=logs&j=bbe4b42d-86e6-5e9c-8a0b-fea01d818a24&t=e00c5a13-c6dc-5e9a-6104-69976170e881 |
Thanks @htuch for the heads up! I can't seem to find any sort of coverage report that would show the untested lines. Indeed, the diff is pretty small, and it looks like I can't find what I don't test:
Thanks! |
https://storage.googleapis.com/envoy-pr/678e161/coverage/source/common/matcher/matcher.h.gcov.html shows that the factory branch is not hit |
Signed-off-by: Adrien Guinet <[email protected]>
678e161
to
a2d6dee
Compare
Thanks @snowp for the link. It was indeed a bit obviousy, sorry for this... I added a test (https://github.com/envoyproxy/envoy/pull/16149/files#diff-c8bf711a6054030b05da908d5fb918835cd40ced54f6e557ef26bff3b0ebaefcR276) that should fix it! |
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!
Please avoid force pushing in future PRs BTW, it makes it hard to follow changes.
Okay @htuch I'll keep it in mind! Thanks for the merge and reviews! |
Signed-off-by: Adrien Guinet <[email protected]> Signed-off-by: Gokul Nair <[email protected]>
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Commit Message: This adds a "not_matcher" matching type to MatcherList.
Additional Description:
Risk Level: low
Testing: unit test (extended field_matcher_test.cc)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]