-
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
Refactor some taskrun fields into helper functions #1110
Conversation
The following is the coverage report on pkg/.
|
@@ -497,6 +450,66 @@ func clearStatus(tr *v1alpha1.TaskRun) { | |||
tr.Status.PodName = "" | |||
} | |||
|
|||
func getTaskrunAnnotations(pr *v1alpha1.PipelineRun) map[string]string { |
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.
It looks like these are still covered by the mega-tests in taskrun_test/pipelinerun_test, but do you think it might be worthwhile to simplify those tests and add coverage here instead?
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.
Yeah, will add some!
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.
Done!
The following is the coverage report on pkg/.
|
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.
😻
THANK YOU!!!! 😻 |
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
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.
I am not sure we should remove the TestReconcile*
tests though, as without them, we do not cover that it actually does that (no matter the implementation/split into functions).
The following is the coverage report on pkg/.
|
This commit refactors the labels, annotations, default timeouts, and service account fields from taskruns into helper functions. This will allow us to easily reuse some common defaults for regular taskruns as well as those created for conditionals in tektoncd#1093 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
Ok, added those back in. Kept the additional tests for timeouts, since that logic is a bit more complex than the other helpers |
The following is the coverage report on pkg/.
|
getTaskRunTimeout sets the timeout values for taskruns created by pipelineruns. While adding the tests, I noticed that if `pr.Spec.Timeout` is nil, we were setting the default timeout to 60 seconds and not minutes. This is really an edge case since we only hit this block if the webhook does not set the defaults properly. Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
The following is the coverage report on pkg/.
|
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, vdemeester 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 |
Looks like we have some flaky unit tests again 🤔 /test pull-tekton-pipeline-integration-tests |
/test pull-tekton-pipeline-integration-tests |
Changes
This commit refactors the labels, annotations, default timeouts, and
service account fields from taskruns into helper functions. This will
allow us to easily reuse some common defaults for regular taskruns as
well as those created for conditionals in #1093
This replaces some of the TestReconcile_ funcs that were testing
only the functionality in these new helper functions with their own
dedicated unit tests
Adds unit tests for
getTaskRunTimeout
, which sets the timeoutvalues for taskrunscreated by pipelineruns. While adding the tests, I
noticedthat if
pr.Spec.Timeout
is nil, we were setting the defaulttimeout to 60 seconds and not minutes. This is really an edge
case since we only hit this block if the webhook does not set
the defaults properly.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them: