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

Fixed logic to choose whether to use filter or filters for a trigger #7286

Merged

Conversation

Cali0707
Copy link
Member

Currently, the logic to select whether to use the trigger.Spec.Filter vs. trigger.Spec.Filters is not correct. If I have provided a trigger.Spec.Filter, and no trigger.Spec.Filters, then currently we would still apply the trigger.Spec.Filters and return filter.NoFilter, instead of applying my trigger.Spec.Filter. This leads to incorrect event processing.

Proposed Changes

  • Fix the logic used to apply the filter vs. the filters field

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

:bug: The filters field now only overrides the filter field on a trigger if there are filters in the filters field.

Docs

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow
Copy link

knative-prow bot commented Sep 22, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 22, 2023
@knative-prow knative-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 22, 2023
@Cali0707
Copy link
Member Author

/cc @pierDipi @creydr @Leo6Leo
This should fix the failing tests on #7243

@Cali0707 Cali0707 marked this pull request as ready for review September 22, 2023 20:36
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 22, 2023
@knative-prow knative-prow bot requested a review from aliok September 22, 2023 20:36
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: +0.04% 🎉

Comparison is base (b704ab1) 77.54% compared to head (ac3c95c) 77.59%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7286      +/-   ##
==========================================
+ Coverage   77.54%   77.59%   +0.04%     
==========================================
  Files         249      249              
  Lines       13407    13404       -3     
==========================================
+ Hits        10397    10401       +4     
+ Misses       2485     2479       -6     
+ Partials      525      524       -1     
Files Changed Coverage Δ
pkg/broker/filter/filter_handler.go 68.99% <66.66%> (+1.82%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

Hey @Cali0707,
thanks for working on this. Could we add a test, to prevent this in future?

Signed-off-by: Calum Murray <cmurray@redhat.com>
@Cali0707
Copy link
Member Author

/cc @creydr

@knative-prow knative-prow bot requested a review from creydr September 25, 2023 13:00
Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2023
@knative-prow
Copy link

knative-prow bot commented Sep 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, creydr

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2023
@knative-prow knative-prow bot merged commit d6483cd into knative:main Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants