Skip to content
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

Merged
merged 1 commit into from Dec 14, 2021
Merged

Move Events test helpers to test package #4405

merged 1 commit into from Dec 14, 2021

Conversation

ghost
Copy link

@ghost ghost commented Dec 3, 2021

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:

Release Notes

NONE

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Dec 3, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 3, 2021
@ghost
Copy link
Author

ghost commented Dec 3, 2021

/cc @lbernick
/cc @bobcatfish

@tekton-robot
Copy link
Collaborator

@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:

/cc @lbernick
/cc @bobcatfish

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.

)

// 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 {
Copy link
Member

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.

Copy link
Author

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 {
Copy link
Author

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.

@lbernick
Copy link
Member

lbernick commented Dec 3, 2021

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.
@ghost
Copy link
Author

ghost commented Dec 3, 2021

/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.

@nikhil-thomas
Copy link
Member

✔️ lgtm

Copy link
Member

@afrittoli afrittoli left a 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

@tekton-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 11, 2021
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@tekton-robot tekton-robot merged commit b26d534 into tektoncd:main Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants