clientv3/integration: expect "ErrCompacted" in "TestKVCompact"

Making tests more strict

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
Gyuho Lee 2020-01-13 11:20:14 -08:00
parent 8aa7a3dc09
commit 255944bf51

View File

@ -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 {