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
Fix leaking goroutine in multiple integration tests by migrating to common StartTestServer utility #110229
Fix leaking goroutine in multiple integration tests by migrating to common StartTestServer utility #110229
Conversation
@wojtek-t: 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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wojtek-t 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 |
7c47c42
to
95d8177
Compare
95d8177
to
8ca1ec2
Compare
testClient, controller, informers, watchPV, watchPVC := createClients(namespaceName, t, s, defaultSyncPeriod) | ||
defer watchPV.Stop() | ||
defer watchPVC.Stop() | ||
|
||
ns := framework.CreateNamespaceOrDie(testClient, namespaceName, t) | ||
defer framework.DeleteNamespaceOrDie(testClient, ns, 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.
you always create the namespace after create the clients in this commit
watchPVC, err := testClient.CoreV1().PersistentVolumeClaims(namespaceName).Watch(context.TODO(), metav1.ListOptions{})
I think that doesn't matter, but is there any special reason?
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.
Before this PR we effectively weren't creating the namespace (CreateTestingNamespace isn't effectively creating a namespace:
https://github.com/kubernetes/kubernetes/blob/master/test/integration/framework/util.go#L54
So we didn't need the client for that.
After switching to more realistic apiserver in this PR (that e.g. has namespace admission plugins enabled) we have to actually create a namespace (or alternatively disable namespace admission plugins, but I think it's better to those test be as realistic as possible), which requires having a client.
So I need to do that after creating a client.
Now the options are:
- refactor the code by splitting client creation and setting up those watches (and create namespaces in the middle)
- leave as is and create namespace after calling
createClients
Since this doesn't matter really, I chose a cheaper to execute option :)
one question #110229 (comment) only |
@aojea - thanks, responded - PTAL |
/lgtm |
Ref #108483
Note to reviewer: I recommend reviewing commit by commit - apart from the first one they are all independent.
/kind cleanup
/priority important-longterm
/sig testing