integration: add serialized range to TestV3CompactCurrentRev

To catch compaction bugs in the proxy key cache.
This commit is contained in:
Anthony Romano 2017-03-24 13:09:54 -07:00
parent 608a2be9c5
commit b9cfa4cef9

View File

@ -123,16 +123,25 @@ func TestV3CompactCurrentRev(t *testing.T) {
t.Fatalf("couldn't put key (%v)", err) t.Fatalf("couldn't put key (%v)", err)
} }
} }
// get key to add to proxy cache, if any
if _, err := kvc.Range(context.TODO(), &pb.RangeRequest{Key: []byte("foo")}); err != nil {
t.Fatal(err)
}
// compact on current revision // compact on current revision
_, err := kvc.Compact(context.Background(), &pb.CompactionRequest{Revision: 4}) _, err := kvc.Compact(context.Background(), &pb.CompactionRequest{Revision: 4})
if err != nil { if err != nil {
t.Fatalf("couldn't compact kv space (%v)", err) t.Fatalf("couldn't compact kv space (%v)", err)
} }
// key still exists? // key still exists when linearized?
_, err = kvc.Range(context.Background(), &pb.RangeRequest{Key: []byte("foo")}) _, err = kvc.Range(context.Background(), &pb.RangeRequest{Key: []byte("foo")})
if err != nil { if err != nil {
t.Fatalf("couldn't get key after compaction (%v)", err) t.Fatalf("couldn't get key after compaction (%v)", err)
} }
// key still exists when serialized?
_, err = kvc.Range(context.Background(), &pb.RangeRequest{Key: []byte("foo"), Serializable: true})
if err != nil {
t.Fatalf("couldn't get serialized key after compaction (%v)", err)
}
} }
func TestV3TxnTooManyOps(t *testing.T) { func TestV3TxnTooManyOps(t *testing.T) {