-
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
Improve taskref_test coverage with more error test cases #6813
Conversation
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/retest |
9b9991e
to
62bdc0e
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
t.Fatal("Expected error but found nil instead") | ||
} | ||
if tc.wantErr.Error() != err.Error() { | ||
t.Fatalf("Received different error ( %#v )", err) |
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.
is it a typo (%#v)? We can also print the expected error to make it easier to debug.
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 think %#v is a Go-syntax representation of the value and this was previously used at
t.Fatalf("Received unexpected error ( %#v )", err) |
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.
nit: can we just use cmp.Diff to compare the expected error to the received error? Alternatively, can we swap back to a bool wantErr to avoid having to change the tests every time we change the error messages?
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 personally lean towards that we should expect to change the error messages in case where we have changed the logics of some errors and there could be changes in sequence of errors being emitted.
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.
In that case, can we use cmp.Diff to compare the expected error to the received error? See also #5882 for more context on why I suggested avoiding comparing error strings (tldr: it's brittle)
Thanks, lgtm! |
/lgtm |
This commit adds test cases with errors to improve taskref_test coverage with clusterTask test cases.
62bdc0e
to
3f51106
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
t.Fatal("Expected error but found nil instead") | ||
} | ||
if tc.wantErr.Error() != err.Error() { | ||
t.Fatalf("Received different error ( %#v )", err) |
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.
In that case, can we use cmp.Diff to compare the expected error to the received error? See also #5882 for more context on why I suggested avoiding comparing error strings (tldr: it's brittle)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lbernick, Yongxuanzhang 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 |
/test pull-tekton-pipeline-go-coverage-df |
@JeromeJu: The specified target(s) for
The following commands are available to trigger optional jobs:
Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/retest |
1 similar comment
/retest |
/test pull-tekton-pipeline-build-tests |
Changes
This commit adds test cases with errors to improve taskref_test coverage with clusterTask test cases.
/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