integration: test header revision in v3 grpc

Related https://github.com/coreos/etcd/issues/4216.
This commit is contained in:
Gyu-Ho Lee 2016-01-14 21:26:13 -08:00
parent 2f9f4220c6
commit 2f2b408686

View File

@ -215,12 +215,12 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
Created: true, Created: true,
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 2},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1},
}, },
}, },
}, },
@ -249,12 +249,12 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
Created: true, Created: true,
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 2},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("fooLong"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1}, Kv: &storagepb.KeyValue{Key: []byte("fooLong"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1},
}, },
}, },
}, },
@ -283,32 +283,32 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
Created: true, Created: true,
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 2},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1},
}, },
}, },
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 3},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 2, Version: 2}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 3, Version: 2},
}, },
}, },
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 4},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 3, Version: 3}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 4, Version: 3},
}, },
}, },
}, },
@ -325,32 +325,32 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
Created: true, Created: true,
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 2},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1},
}, },
}, },
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 3},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 2, Version: 2}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 3, Version: 2},
}, },
}, },
}, },
{ {
Header: &pb.ResponseHeader{Revision: 1}, Header: &pb.ResponseHeader{Revision: 4},
Created: false, Created: false,
Events: []*storagepb.Event{ Events: []*storagepb.Event{
{ {
Type: storagepb.PUT, Type: storagepb.PUT,
Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 3, Version: 3}, Kv: &storagepb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 4, Version: 3},
}, },
}, },
}, },
@ -391,7 +391,7 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
t.Fatalf("#%d.%d: unexpected nil resp.Header", i, j) t.Fatalf("#%d.%d: unexpected nil resp.Header", i, j)
} }
if resp.Header.Revision != wresp.Header.Revision { if resp.Header.Revision != wresp.Header.Revision {
t.Logf("[TODO - skip for now] #%d.%d: resp.Header.Revision got = %d, want = %d", i, j, resp.Header.Revision, wresp.Header.Revision) t.Errorf("#%d.%d: resp.Header.Revision got = %d, want = %d", i, j, resp.Header.Revision, wresp.Header.Revision)
} }
if wresp.Created != resp.Created { if wresp.Created != resp.Created {