-
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
Move Events test helpers to test package #4405
Conversation
/cc @lbernick |
@sbwsg: GitHub didn't allow me to request PR reviews from the following users: lbernick. Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs. 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/events/events.go
Outdated
) | ||
|
||
// CheckEvents checks that the events received by the FakeRecorder are the same as wantEvents, | ||
// in the same order. | ||
func CheckEvents(t *testing.T, fr *record.FakeRecorder, testName string, wantEvents []string) error { | ||
func CheckEvents(t *testing.T, eventChan chan string, testName string, wantEvents []string) error { |
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 function could become CheckEventsOrdered and the latter can be CheckEventsUnordered. You can remove references to FakeClient and FakeRecorder in the docstrings as well.
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.
👍 great catch, done.
@@ -37,9 +35,9 @@ func CheckEvents(t *testing.T, fr *record.FakeRecorder, testName string, wantEve | |||
|
|||
// CheckCloudEvents checks that all events in wantEvents, and no others, were received by the FakeClient | |||
// in any order. | |||
func CheckCloudEvents(t *testing.T, fce *FakeClient, testName string, wantEvents []string) error { |
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 FakeClient
has been removed in favor of the string chan because FakeClient
has been exported as part of the cloudevents package since forever and would cause a circular dependency if kept here. Refactoring where that lives is a whole different can of worms.
thanks for this! |
Previously the helpers in pkg/reconciler/events/event_test.go were exported publicly as part of the pkg/reconciler/events package. This commit moves the helpers to the dedicated test package. The helpers' signatures have been updated to prevent a circular dependency with the pkg/reconciler/events/cloudevent package.
/test pull-tekton-pipeline-alpha-integration-tests Workspace-in-isolation example test ran past its timeout with the sidecar waiting to see a signal from the step container. |
✔️ lgtm |
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 @sbwsg !
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli 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 |
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
Changes
Previously the helpers in pkg/reconciler/events/event_test.go were
exported publicly as part of the pkg/reconciler/events package.
This commit moves the helpers to the dedicated test package. The
helpers' signatures have been updated to prevent a circular dependency with
the pkg/reconciler/events/cloudevent package.
/kind cleanup
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes