Skip to content
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

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

aguinet
Copy link
Contributor

@aguinet aguinet commented Apr 23, 2021

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:]

@repokitteh-read-only
Copy link

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.

🐱

Caused by: #16149 was opened by aguinet.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
envoyproxy/api-shepherds assignee is @htuch
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #16149 was opened by aguinet.

see: more, trace.

@aguinet aguinet force-pushed the feature/not_matcher branch from 94763b2 to 3d7573d Compare April 23, 2021 19:21
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aguinet this makes sense API-wise. Given how simple the API change is, I'd suggest folding the implementation & tests into this PR. Thanks.

@snowp FYI, how come we didn't include this to start with?

/wait

Copy link
Contributor Author

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!

Copy link
Contributor

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

@htuch
Copy link
Member

htuch commented Apr 27, 2021

Looks good, @aguinet can you fix DCO? Thanks
/wait

@aguinet
Copy link
Contributor Author

aguinet commented Apr 27, 2021

Looks good, @aguinet can you fix DCO? Thanks
/wait

DCO fixed! Pushed --force

@htuch
Copy link
Member

htuch commented Apr 28, 2021

@aguinet
Copy link
Contributor Author

aguinet commented Apr 28, 2021

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!

@snowp
Copy link
Contributor

snowp commented Apr 28, 2021

Signed-off-by: Adrien Guinet <[email protected]>
@aguinet aguinet force-pushed the feature/not_matcher branch from 678e161 to a2d6dee Compare April 29, 2021 16:56
@aguinet
Copy link
Contributor Author

aguinet commented Apr 29, 2021

https://storage.googleapis.com/envoy-pr/678e161/coverage/source/common/matcher/matcher.h.gcov.html shows that the factory branch is not hit

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!

Copy link
Member

@htuch htuch left a 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.

@yanavlasov yanavlasov merged commit 5886f03 into envoyproxy:main Apr 30, 2021
@aguinet
Copy link
Contributor Author

aguinet commented Apr 30, 2021

Okay @htuch I'll keep it in mind! Thanks for the merge and reviews!

gokulnair pushed a commit to gokulnair/envoy that referenced this pull request May 6, 2021
Signed-off-by: Adrien Guinet <[email protected]>
Signed-off-by: Gokul Nair <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants