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

Fix leaking goroutine in multiple integration tests by migrating to common StartTestServer utility #110229

Merged
merged 20 commits into from May 27, 2022

Conversation

wojtek-t
Copy link
Member

@wojtek-t wojtek-t commented May 26, 2022

Ref #108483

Note to reviewer: I recommend reviewing commit by commit - apart from the first one they are all independent.

NONE

/kind cleanup
/priority important-longterm
/sig testing

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels May 26, 2022
@k8s-ci-robot
Copy link
Contributor

@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 triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 26, 2022
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels May 26, 2022
@aojea
Copy link
Member

aojea commented May 26, 2022

/assign

Comment on lines +960 to +965
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)
Copy link
Member

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?

Copy link
Member Author

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

@aojea
Copy link
Member

aojea commented May 26, 2022

one question #110229 (comment) only

@wojtek-t
Copy link
Member Author

@aojea - thanks, responded - PTAL

@aojea
Copy link
Member

aojea commented May 27, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 27, 2022
@k8s-ci-robot k8s-ci-robot merged commit 61b983a into kubernetes:master May 27, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone May 27, 2022
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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants