clientv3/integration: drain keepalives before waiting for leader loss

500ms keepalive delay on proxy side causes client to sometimes send
a second keepalive since it waits more than 500ms for the first response.

Fixes #7658
This commit is contained in:
Anthony Romano 2017-05-03 13:22:45 -07:00
parent 8f40517adb
commit f6d0dda187

View File

@ -729,6 +729,12 @@ func TestLeaseWithRequireLeader(t *testing.T) {
}
clus.Members[1].Stop(t)
// kaReqLeader may issue multiple requests while waiting for the first
// response from proxy server; drain any stray keepalive responses
time.Sleep(100 * time.Millisecond)
for len(kaReqLeader) > 0 {
<-kaReqLeader
}
select {
case resp, ok := <-kaReqLeader: