-
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
Cleanup unit tests to use idiomatic Go. #5916
Conversation
ping @ijschwabacher |
/kind cleanup |
/test check-pr-has-kind-label |
@bendory: 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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lbernick 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 |
/assign @afrittoli |
ec := NewEntrypointerAPIClient(cfg) | ||
defer ec.Close() | ||
|
||
if _, err := ec.Sign(ctx, nil); !errors.Is(err, context.DeadlineExceeded) { |
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.
Wait, we're passing in context.Background()
and we want to get context.DeadlineExceeded
? So we're effectively testing that the timeout is used here? Is this an admission that there are potentially too many dependencies on that method to move the timeout back out into the caller?
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.
The implementation as written has its own embedded timeout, and IDK the implications of changing that implementation to move the timeout up to the caller. This was a pre-existing test that I have rewritten into idiomatic Go using errors.Is
rather than generically checking that an error was returned (which is what the old test did).
I agree that this implementation could be better, but that's not my current focus. 🙈
This PR is a follow-on from #5904 (comment) There are no expected functional changes in this PR. /kind cleanup
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. |
/test tekton-pipeline-unit-tests |
/lgtm |
Changes
This PR is a follow-on from #5904 (comment) to make spire tests more readable, easier to understand, and conformant with idiomatic Golang style.
There are no expected functional changes in this PR.
Changes:
spire_mock_test.go
: Renamed test functions fromTestSpireMock_*
-->TestMock_*
spire_test.go
:TestSpire_*
-->Test*
testSingleTaskRun()
,testSinglePipelineResourceResults()
helpersgenPr()
andsuccess := func()...
)got
,want
in tests/kind cleanup
Ref: #5899
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes