mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #7769 from heyitsanthony/more-time-lease-test
clientv3/integration: sleep less in TestLeaseRenewLostQuorum
This commit is contained in:
commit
35dff4cbc3
@ -586,17 +586,24 @@ func TestLeaseRenewLostQuorum(t *testing.T) {
|
|||||||
}
|
}
|
||||||
// consume first keepalive so next message sends when cluster is down
|
// consume first keepalive so next message sends when cluster is down
|
||||||
<-ka
|
<-ka
|
||||||
|
lastKa := time.Now()
|
||||||
|
|
||||||
// force keepalive stream message to timeout
|
// force keepalive stream message to timeout
|
||||||
clus.Members[1].Stop(t)
|
clus.Members[1].Stop(t)
|
||||||
clus.Members[2].Stop(t)
|
clus.Members[2].Stop(t)
|
||||||
// Use TTL-1 since the client closes the keepalive channel if no
|
// Use TTL-2 since the client closes the keepalive channel if no
|
||||||
// keepalive arrives before the lease deadline.
|
// keepalive arrives before the lease deadline; the client will
|
||||||
// The cluster has 1 second to recover and reply to the keepalive.
|
// try to resend a keepalive after TTL/3 seconds, so for a TTL of 4,
|
||||||
time.Sleep(time.Duration(r.TTL-1) * time.Second)
|
// sleeping for 2s should be sufficient time for issuing a retry.
|
||||||
|
// The cluster has two seconds to recover and reply to the keepalive.
|
||||||
|
time.Sleep(time.Duration(r.TTL-2) * time.Second)
|
||||||
clus.Members[1].Restart(t)
|
clus.Members[1].Restart(t)
|
||||||
clus.Members[2].Restart(t)
|
clus.Members[2].Restart(t)
|
||||||
|
|
||||||
|
if time.Since(lastKa) > time.Duration(r.TTL)*time.Second {
|
||||||
|
t.Skip("waited too long for server stop and restart")
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case _, ok := <-ka:
|
case _, ok := <-ka:
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user