mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #331 from dchen1107/cleanup
Fixed the data race found in kubelet_test.go
This commit is contained in:
commit
67eae1f645
@ -834,7 +834,12 @@ func TestWatchEtcd(t *testing.T) {
|
|||||||
data, err := json.Marshal(manifest)
|
data, err := json.Marshal(manifest)
|
||||||
expectNoError(t, err)
|
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{
|
watchChannel <- &etcd.Response{
|
||||||
Node: &etcd.Node{
|
Node: &etcd.Node{
|
||||||
@ -842,6 +847,7 @@ func TestWatchEtcd(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
close(watchChannel)
|
close(watchChannel)
|
||||||
|
wg.Wait()
|
||||||
close(updateChannel)
|
close(updateChannel)
|
||||||
|
|
||||||
read := reader.GetList()
|
read := reader.GetList()
|
||||||
|
Loading…
Reference in New Issue
Block a user