Filtering fix for consistency in handling empty string as value#5273
Conversation
|
Hi @Shashankft9. Thanks for your PR. I'm waiting for a knative 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. DetailsInstructions 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. |
Codecov Report
@@ Coverage Diff @@
## main #5273 +/- ##
==========================================
+ Coverage 83.34% 83.39% +0.04%
==========================================
Files 243 243
Lines 6882 6883 +1
==========================================
+ Hits 5736 5740 +4
+ Misses 797 795 -2
+ Partials 349 348 -1
Continue to review full report at Codecov.
|
|
/assign @zhongduo |
|
@pierDipi might have more context and opinion on this. |
|
/assign @pierDipi |
|
I'm gonna take a look at this soon! Thanks! /cc |
| "dataschema": event.DataSchema(), | ||
| "schemaurl": event.DataSchema(), | ||
| "datacontenttype": event.DataContentType(), | ||
| "datamediatype": event.DataMediaType(), |
There was a problem hiding this comment.
datamediatype is not a real attribute.
| @@ -59,8 +60,10 @@ func (attrs attributesFilter) Filter(ctx context.Context, event cloudevents.Even | |||
| for k, v := range attrs { | |||
There was a problem hiding this comment.
This entire method should be rewritten to me more performant. No need to explode the event for filters that do not care about most of the attributes.
There was a problem hiding this comment.
(this comment was not about this PR, but the code in general. I used it to make a new issue)
| // If the attribute does not exist in the event (extension context attributes) or if the event attribute | ||
| // has an empty string value (optional attributes) - which means it was never set in the incoming event, | ||
| // return false. | ||
| if !ok || (v == eventingv1.TriggerAnyFilter && value == "") { |
| event: makeEventWithExtension(extensionName, extensionValue), | ||
| want: eventfilter.PassFilter, | ||
| }, | ||
| "Any Extension with attribs - without Extension in Event": { |
There was a problem hiding this comment.
Thank you for the tests 👍
|
/ok-to-test Looks good to me! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: n3wscott The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The following is the coverage report on the affected files.
|
Fixes #4847
Proposed Changes
dataschema- an optional attribute in v1.0 CE specsubject. Let me know if its better without some of them, I'll remove.Release Note
Docs