mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #82239 from sttts/sttts-persistentvolume-controller-data-race
persistentvolume-controller: fix data race of non-deepcopied objects in fake client
This commit is contained in:
commit
cedffee93e
@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
@ -260,12 +260,14 @@ func TestControllerSync(t *testing.T) {
|
||||
|
||||
reactor := newVolumeReactor(client, ctrl, fakeVolumeWatch, fakeClaimWatch, test.errors)
|
||||
for _, claim := range test.initialClaims {
|
||||
claim = claim.DeepCopy()
|
||||
reactor.AddClaim(claim)
|
||||
go func(claim *v1.PersistentVolumeClaim) {
|
||||
fakeClaimWatch.Add(claim)
|
||||
}(claim)
|
||||
}
|
||||
for _, volume := range test.initialVolumes {
|
||||
volume = volume.DeepCopy()
|
||||
reactor.AddVolume(volume)
|
||||
go func(volume *v1.PersistentVolume) {
|
||||
fakeVolumeWatch.Add(volume)
|
||||
|
Loading…
Reference in New Issue
Block a user