mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +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:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user