-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add E2E Testing for Matrix #6944
Conversation
fc2cbdb
to
c657877
Compare
Thanks for adding these tests @EmmaMunley /test pull-tekton-pipeline-go-coverage |
/test pull-tekton-pipeline-go-coverage |
c657877
to
1fc4c35
Compare
test/matrix_test.go
Outdated
// 3rd task run failing will cause the PipelineRun to fail, however the first 2 TaskRuns | ||
// should succeed before the last one fails. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What guarantees the first 2 taskruns succeed before the third fails? Does this test have the potential to be flaky if the third fails too quickly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm if I add WaitForTaskRunState()
, will that ensure the TaskRuns finish in the correct order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it'll just wait until the taskrun has reached the desired state, or the test times out. I don't think you can guarantee that parallel taskruns will finish in a certain order; you could add sleep statements but this can be brittle and adds latency. It's possible that the first test class you have is sufficient for e2e testing; do you think this test class covers cases that the first does not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case tests a failing TaskRun produced by a Matrix, which isn't covered in the first case. I know this is something @pritidesai wanted tested separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could just have the failing taskrun then, and once TEP 50 is implemented we can use that to ensure the pipeline continues even when one of the tasks fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I changed it just one taskRun checking the status that both the taskRun and PipelineRun failed.
cc: @pritidesai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to continue with the original implementation, you can check the competition time of two succeeded taskRuns against the competition time of a failed task.
1fc4c35
to
f088900
Compare
f088900
to
181520d
Compare
1) TestPipelineRunMatrixed is an integration test that verifies that a Matrixed PipelineRun succeeds with both `matrix params` and `matrix include params`. It also tests array indexing and whole array replacements by consuming results produced by other PipelineTasks. 2) TestPipelineRunMatrixedFailed is an integration test with a Matrixed PipelineRun that contains an unsuccessful TaskRun. This test verifies that the taskRun will fail, which will cause the entire PipelineRun to fail.2) TestPipelineRunMatrixedFailed is an integration test with a Matrixed PipelineRun that contains an unsuccessful TaskRun. This test verifies that the taskRun will fail, which will cause the entire PipelineRun to fail.
181520d
to
bee0412
Compare
/assign @pritidesai |
t.Fatalf("Did not get expected TaskRuns: %s", diff.PrintWantGot(d)) | ||
} | ||
|
||
t.Logf("Successfully finished test TestPipelineRunMatrixed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite an extensive testing done, thanks a bunch for this detailed test case.
NIT: An additional or alternative way of testing this run can be done with comparing "status.childReferences[]".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @EmmaMunley 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pritidesai 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 |
/lgtm |
Changes
This PR adds 2 E2E Integration Tests:
TestPipelineRunMatrixed
is an integration test that verifies that a Matrixed PipelineRun succeeds with bothmatrix params
andmatrix include params
. It also tests array indexing and whole array replacements by consuming results produced by other PipelineTasks.TestPipelineRunMatrixedFailed
is an integration test with a Matrixed PipelineRun that contains 2 successful, and 1 unsucessful TaskRun. This test verifies that the 3rd task run failing will cause the PipelineRun to fail, however the first 2 TaskRuns should succeed before the last one fails./kind misc
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes