mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #5976 from heyitsanthony/fix-kadc
integration: drain keepalives in TestLeaseKeepAliveCloseAfterDisconnectRevoke
This commit is contained in:
commit
fcc96c9ebd
@ -359,7 +359,8 @@ func TestLeaseKeepAliveCloseAfterDisconnectRevoke(t *testing.T) {
|
|||||||
if kerr != nil {
|
if kerr != nil {
|
||||||
t.Fatal(kerr)
|
t.Fatal(kerr)
|
||||||
}
|
}
|
||||||
if kresp := <-rc; kresp.ID != resp.ID {
|
kresp := <-rc
|
||||||
|
if kresp.ID != resp.ID {
|
||||||
t.Fatalf("ID = %x, want %x", kresp.ID, resp.ID)
|
t.Fatalf("ID = %x, want %x", kresp.ID, resp.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,14 +375,15 @@ func TestLeaseKeepAliveCloseAfterDisconnectRevoke(t *testing.T) {
|
|||||||
|
|
||||||
clus.Members[0].Restart(t)
|
clus.Members[0].Restart(t)
|
||||||
|
|
||||||
|
// some keep-alives may still be buffered; drain until close
|
||||||
|
timer := time.After(time.Duration(kresp.TTL) * time.Second)
|
||||||
|
for kresp != nil {
|
||||||
select {
|
select {
|
||||||
case ka, ok := <-rc:
|
case kresp = <-rc:
|
||||||
if ok {
|
case <-timer:
|
||||||
t.Fatalf("unexpected keepalive %v", ka)
|
|
||||||
}
|
|
||||||
case <-time.After(5 * time.Second):
|
|
||||||
t.Fatalf("keepalive channel did not close")
|
t.Fatalf("keepalive channel did not close")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestLeaseKeepAliveInitTimeout ensures the keep alive channel closes if
|
// TestLeaseKeepAliveInitTimeout ensures the keep alive channel closes if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user