-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
resolve goroutine leak in nodelifecycle tests #109185
resolve goroutine leak in nodelifecycle tests #109185
Conversation
@kerthcet: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/retest |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
fe12b10
to
c0c600d
Compare
/retest |
There seems to be a lot of diffs -- can you give details as to what code path leaks the goroutine in your Git commit message? |
/assign |
c0c600d
to
26583e7
Compare
controller.recorder = testutil.NewFakeRecorder() | ||
go controller.Run(context.TODO()) | ||
go controller.Run(ctx) |
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.
Case1: Use the contexture ctx rather than the empty one to prevent potential goroutine leakage.
if item.additionalSleep > 0 { | ||
time.Sleep(item.additionalSleep) | ||
} | ||
t.Run(item.description, func(t *testing.T) { |
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.
Case 2: use the most commonly used pattern t.Run()
to organize the tests, so we can defer to call cancel()
with each testcase.
/retest |
Thanks for responding, I updated with the comments. No special logic changes. |
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bowei, kerthcet 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 |
Signed-off-by: kerthcet <kerthcet@gmail.com>
26583e7
to
b4277e7
Compare
Rebased the master branch, we need to LGTM again. Thanks @bowei |
/lgtm |
Signed-off-by: kerthcet kerthcet@gmail.com
What type of PR is this?
/kind bug
/sig apps
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: