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

fixing that triggers can actually have no filters... #2700

Conversation

matzew
Copy link
Member

@matzew matzew commented Mar 4, 2020

Fixes #2695 (and is a backport of 2696 to the knative:release-0.13 branch)

Proposed Changes

  • fixing the conversion to create empty TriggerFilter{}, and not requiring actual attributes in there

Release Note

- 🐛 Fix bug fix broken trigger to NOT require a filter

Docs

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 4, 2020
@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 4, 2020
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 4, 2020
@slinkydeveloper
Copy link
Contributor

@matzew can you add at least a unit test for this?

for k, v := range *source.Spec.Filter.Attributes {
sink.Spec.Filter.Attributes[k] = v
}
}
if source.Spec.Filter.DeprecatedSourceAndType != nil {
sink.Spec.Filter = &v1beta1.TriggerFilter{
Attributes: make(v1beta1.TriggerFilterAttributes, 0),
Copy link
Member

Choose a reason for hiding this comment

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

could we not just make this slice at least two already given that we default to adding a source and type attribute?

Copy link
Contributor

@vaikas vaikas left a comment

Choose a reason for hiding this comment

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

Could we add unit tests to make sure we don't regress? I see there's one testing without Trigger, wondering why it doesn't catch this.

}
if source.Spec.Filter.Attributes != nil {
sink.Spec.Filter = &v1beta1.TriggerFilter{
Attributes: make(v1beta1.TriggerFilterAttributes, 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of 0, how about?
len(source.Spec.Filter.Attributes)

@knative-prow-robot knative-prow-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/test-and-release Test infrastructure, tests or release and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 4, 2020
@matzew
Copy link
Member Author

matzew commented Mar 4, 2020

@vaikas in #2701 I have changed a test to create a v1beta1 trigger (instead of v1alpha1), and it fails.

Here I've the change and the update to the test

@vaikas
Copy link
Contributor

vaikas commented Mar 4, 2020

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 4, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, vaikas

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-robot knative-prow-robot merged commit 5619334 into knative:release-0.13 Mar 4, 2020
@lberk lberk mentioned this pull request Sep 1, 2020
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. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. 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.

6 participants