mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Merge pull request #47061 from madhusudancs/fed-sync-loop-clause-bug
Automatic merge from submit-queue (batch tested with PRs 46977, 47005, 47018, 47061, 46809) Directly grab map values instead of using loop-clause variables when setting up federated sync controller tests. Go's loop-clause variables are allocated once and the items are copied to that variable while iterating through the loop. This means, these variables can't escape the scope since closures are bound to loop-clause variables whose value change during each iteration. Doing so would lead to undesired behavior. For more on this topic see: https://github.com/golang/go/wiki/CommonMistakes So in order to workaround this problem in sync controller e2e tests, we iterate through the map and copy the map value to a variable inside the loop before using it in closures. Fixes issue: #47059 **Release note**: ```release-note NONE ``` /assign @marun @shashidharatd @perotinus cc @csbell @nikhiljindal /sig federation
This commit is contained in:
commit
3b14924904
@ -32,7 +32,9 @@ var _ = framework.KubeDescribe("Federated types [Feature:Federation][Experimenta
|
||||
|
||||
f := fedframework.NewDefaultFederatedFramework("federated-types")
|
||||
|
||||
for name, fedType := range federatedtypes.FederatedTypes() {
|
||||
fedTypes := federatedtypes.FederatedTypes()
|
||||
for name := range fedTypes {
|
||||
fedType := fedTypes[name]
|
||||
Describe(fmt.Sprintf("Federated %q resources", name), func() {
|
||||
It("should be created, read, updated and deleted successfully", func() {
|
||||
fedframework.SkipUnlessFederated(f.ClientSet)
|
||||
|
Loading…
Reference in New Issue
Block a user