mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
integration: wait five elections before creating watch for require leader test
Otherwise new watch will race with the leader watcher receiving the loss event.
This commit is contained in:
parent
36f5b713bf
commit
a4a8393cb7
@ -681,7 +681,9 @@ func TestWatchWithRequireLeader(t *testing.T) {
|
||||
|
||||
// wait for election timeout, then member[0] will not have a leader.
|
||||
tickDuration := 10 * time.Millisecond
|
||||
time.Sleep(time.Duration(3*clus.Members[0].ElectionTicks) * tickDuration)
|
||||
// existing streams need three elections before they're torn down; wait until 5 elections cycle
|
||||
// so proxy tests receive a leader loss event on its existing watch before creating a new watch.
|
||||
time.Sleep(time.Duration(5*clus.Members[0].ElectionTicks) * tickDuration)
|
||||
|
||||
chLeader := liveClient.Watch(clientv3.WithRequireLeader(context.TODO()), "foo", clientv3.WithRev(1))
|
||||
chNoLeader := liveClient.Watch(context.TODO(), "foo", clientv3.WithRev(1))
|
||||
|
Loading…
x
Reference in New Issue
Block a user