cloud-provider-gcp icon indicating copy to clipboard operation
cloud-provider-gcp copied to clipboard

Fix broken `TestCACacheVerify` test

Open omertuc opened this issue 3 years ago • 16 comments

Parallel test closures execute in a goroutine, possibly after the next loop iteration has already began. As a result, the loop var they capture changes before the test execute, leading to all of them executing just the last test in the map.

This fixes that by making the closure capture local variables rather than the loop variables

See similar main kubernetes repo PR https://github.com/kubernetes/kubernetes/pull/111846

omertuc avatar Aug 29 '22 08:08 omertuc

Welcome @omertuc!

It looks like this is your first PR to kubernetes/cloud-provider-gcp 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/cloud-provider-gcp has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Aug 29 '22 08:08 k8s-ci-robot

Hi @omertuc. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 avatar Aug 29 '22 08:08 k8s-ci-robot

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 27 '22 08:11 k8s-triage-robot

/remove-lifecycle stale

omertuc avatar Nov 28 '22 09:11 omertuc

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Feb 26 '23 10:02 k8s-triage-robot

/remove-lifecycle stale

omertuc avatar Feb 27 '23 10:02 omertuc

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 28 '23 10:05 k8s-triage-robot

/remove-lifecycle stale

omertuc avatar May 29 '23 13:05 omertuc

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 19 '24 10:01 k8s-triage-robot

/remove-lifecycle stale

omertuc avatar Jan 19 '24 14:01 omertuc

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 18 '24 15:04 k8s-triage-robot

/remove-lifecycle stale

omertuc avatar Apr 18 '24 15:04 omertuc

This has been fixed in 1.22 , no?

https://go.dev/blog/loopvar-preview

aojea avatar Apr 18 '24 15:04 aojea

This has been fixed in 1.22 , no?

go.dev/blog/loopvar-preview

Good point. If you're using >1.22 then I guess this could be closed

omertuc avatar Apr 18 '24 15:04 omertuc

Looks like it's still 1.21 on this project's go.mod:

https://github.com/kubernetes/cloud-provider-gcp//blob/baff5fc401bde5e3149cd292967c0cab567f3b9d/go.mod#L3

omertuc avatar Apr 18 '24 15:04 omertuc

/ok-to-test

aojea avatar Jun 12 '24 22:06 aojea

Forced push to refresh seemingly stuck EasyCLA check

(Also rebased)

omertuc avatar Jun 13 '24 09:06 omertuc

/lgtm /approve

Thanks

aojea avatar Jun 13 '24 13:06 aojea

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, omertuc

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 avatar Jun 13 '24 13:06 k8s-ci-robot