mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Fixed the data race found in kubelet_test.go
This commit is contained in:
		@@ -887,7 +887,12 @@ func TestWatchEtcd(t *testing.T) {
 | 
			
		||||
	data, err := json.Marshal(manifest)
 | 
			
		||||
	expectNoError(t, err)
 | 
			
		||||
 | 
			
		||||
	go kubelet.WatchEtcd(watchChannel, updateChannel)
 | 
			
		||||
	var wg sync.WaitGroup
 | 
			
		||||
	wg.Add(1)
 | 
			
		||||
	go func() {
 | 
			
		||||
		kubelet.WatchEtcd(watchChannel, updateChannel)
 | 
			
		||||
		wg.Done()
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	watchChannel <- &etcd.Response{
 | 
			
		||||
		Node: &etcd.Node{
 | 
			
		||||
@@ -895,6 +900,7 @@ func TestWatchEtcd(t *testing.T) {
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	close(watchChannel)
 | 
			
		||||
	wg.Wait()
 | 
			
		||||
	close(updateChannel)
 | 
			
		||||
 | 
			
		||||
	read := reader.GetList()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user