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

Fix bug running multiple triggers #388

Merged
merged 1 commit into from
Jan 27, 2020
Merged

Conversation

ncskier
Copy link
Member

@ncskier ncskier commented Jan 27, 2020

Changes

Fixes #387
This PR fixes a pointer bug where an EventListener with n triggers
would have the last trigger execute n times instead of all n
triggers executing once.

This PR also updates the TestHandleEvent function to test multiple
triggers. In the future, it might be worth refactoring the
TestHandleEvent function into a testing table, so we can increase our
test coverage.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Fixes tektoncd#387
This PR fixes a pointer bug where an EventListener with `n` triggers
would have the last trigger execute `n` times instead of all `n`
triggers executing once.

This PR also updates the TestHandleEvent function to test multiple
triggers. In the future, it might be worth refactoring the
TestHandleEvent function into a testing table, so we can increase our
test coverage.
@ncskier ncskier requested review from wlynch and dibyom January 27, 2020 18:47
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 27, 2020
@@ -131,8 +146,11 @@ func TestHandleEvent(t *testing.T) {
if _, err := triggersClient.TektonV1alpha1().TriggerTemplates(namespace).Create(tt); err != nil {
t.Fatalf("Error creating TriggerTemplate: %s", err)
}
if _, err := triggersClient.TektonV1alpha1().TriggerBindings(namespace).Create(tb); err != nil {
t.Fatalf("Error creating TriggerBinding: %s", err)
// for _, tb := range []*triggersv1.TriggerBinding{tb, tb2, tb3} {
Copy link
Member

Choose a reason for hiding this comment

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

Remove?

},
},
}
// var wantResources []pipelinev1.PipelineResource
Copy link
Member

Choose a reason for hiding this comment

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

Remove comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 27, 2020
@dibyom dibyom added this to the Triggers 0.2.1 milestone Jan 27, 2020
Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

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

/lgtm

},
},
}
// var wantResources []pipelinev1.PipelineResource
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove?

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, wlynch

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

@tekton-robot tekton-robot merged commit 7e5af75 into tektoncd:master Jan 27, 2020
@ncskier ncskier mentioned this pull request Jan 27, 2020
3 tasks
@ncskier
Copy link
Member Author

ncskier commented Jan 27, 2020

Sorry, I forgot to clean up those comments. I created a PR to clean it up here: #389

@ncskier ncskier deleted the issue387 branch January 27, 2020 19:39
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single trigger fired multiple times when multiple triggers exist
4 participants