mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #11540 from gyuho/tests
clientv3/integration: fix tests
This commit is contained in:
@@ -665,12 +665,23 @@ func TestKVCompact(t *testing.T) {
|
||||
|
||||
wchan := wcli.Watch(ctx, "foo", clientv3.WithRev(3))
|
||||
|
||||
if wr := <-wchan; wr.CompactRevision != 7 {
|
||||
wr := <-wchan
|
||||
if wr.CompactRevision != 7 {
|
||||
t.Fatalf("wchan CompactRevision got %v, want 7", wr.CompactRevision)
|
||||
}
|
||||
if wr, ok := <-wchan; ok {
|
||||
if !wr.Canceled {
|
||||
t.Fatalf("expected canceled watcher on compacted revision, got %v", wr.Canceled)
|
||||
}
|
||||
if wr.Err() != rpctypes.ErrCompacted {
|
||||
t.Fatalf("watch response error expected %v, got %v", rpctypes.ErrCompacted, wr.Err())
|
||||
}
|
||||
wr, ok := <-wchan
|
||||
if ok {
|
||||
t.Fatalf("wchan got %v, expected closed", wr)
|
||||
}
|
||||
if wr.Err() != nil {
|
||||
t.Fatalf("watch response error expected nil, got %v", wr.Err())
|
||||
}
|
||||
|
||||
_, err = kv.Compact(ctx, 1000)
|
||||
if err == nil || err != rpctypes.ErrFutureRev {
|
||||
|
||||
@@ -268,16 +268,10 @@ func TestLeaseKeepAliveNotFound(t *testing.T) {
|
||||
|
||||
<-lchs[0].ch
|
||||
if _, ok := <-lchs[0].ch; !ok {
|
||||
t.Fatalf("closed keepalive on wrong lease")
|
||||
t.Fatal("closed keepalive on wrong lease")
|
||||
}
|
||||
|
||||
timec := time.After(5 * time.Second)
|
||||
for range lchs[1].ch {
|
||||
select {
|
||||
case <-timec:
|
||||
t.Fatalf("revoke did not close keep alive")
|
||||
default:
|
||||
}
|
||||
if _, ok := <-lchs[1].ch; ok {
|
||||
t.Fatal("expected closed keepalive")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user