mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
gofmt -r "condChannelsReady->condWatchCompleted"
This commit is contained in:
parent
905c6dcb10
commit
7b432eac5c
@ -30,7 +30,7 @@ type EtcdResponseWithError struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FakeEtcdClient struct {
|
type FakeEtcdClient struct {
|
||||||
condChannelsReady *sync.Cond
|
condWatchCompleted *sync.Cond
|
||||||
condLock sync.Mutex
|
condLock sync.Mutex
|
||||||
|
|
||||||
Data map[string]EtcdResponseWithError
|
Data map[string]EtcdResponseWithError
|
||||||
@ -54,7 +54,7 @@ func MakeFakeEtcdClient(t *testing.T) *FakeEtcdClient {
|
|||||||
// watchChanReady: make(chan bool),
|
// watchChanReady: make(chan bool),
|
||||||
}
|
}
|
||||||
// The channels are not ready yet
|
// The channels are not ready yet
|
||||||
ret.condChannelsReady = sync.NewCond(&ret.condLock)
|
ret.condWatchCompleted = sync.NewCond(&ret.condLock)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, err
|
|||||||
func (f *FakeEtcdClient) WaitForWatchCompletion() {
|
func (f *FakeEtcdClient) WaitForWatchCompletion() {
|
||||||
f.condLock.Lock()
|
f.condLock.Lock()
|
||||||
defer f.condLock.Unlock()
|
defer f.condLock.Unlock()
|
||||||
f.condChannelsReady.Wait()
|
f.condWatchCompleted.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) {
|
func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) {
|
||||||
@ -120,13 +120,13 @@ func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool,
|
|||||||
f.WatchInjectError = injectedError
|
f.WatchInjectError = injectedError
|
||||||
|
|
||||||
f.condLock.Lock()
|
f.condLock.Lock()
|
||||||
f.condChannelsReady.Broadcast()
|
f.condWatchCompleted.Broadcast()
|
||||||
f.condLock.Unlock()
|
f.condLock.Unlock()
|
||||||
|
|
||||||
// After calling this function, the WatchStop channel will not be ready
|
// After calling this function, the WatchStop channel will not be ready
|
||||||
defer func() {
|
defer func() {
|
||||||
f.condLock.Lock()
|
f.condLock.Lock()
|
||||||
f.condChannelsReady = sync.NewCond(&f.condLock)
|
f.condWatchCompleted = sync.NewCond(&f.condLock)
|
||||||
f.condLock.Unlock()
|
f.condLock.Unlock()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user