Skip to content

Commit

Permalink
integration: cancel operation for unsynced watcher
Browse files Browse the repository at this point in the history
Related etcd-io#4216.
  • Loading branch information
gyuho authored and mitake committed Jan 21, 2016
1 parent 1cfb29d commit 1df5685
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions integration/v3_grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,17 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
}
}

// TestV3WatchCancel tests Watch APIs cancellation.
func TestV3WatchCancel(t *testing.T) {
// TestV3WatchCancelSynced tests Watch APIs cancellation from synced map.
func TestV3WatchCancelSynced(t *testing.T) {
testV3WatchCancel(t, 0)
}

// TestV3WatchCancelUnsynced tests Watch APIs cancellation from unsynced map.
func TestV3WatchCancelUnsynced(t *testing.T) {
testV3WatchCancel(t, 1)
}

func testV3WatchCancel(t *testing.T, startRev int64) {
clus := newClusterGRPC(t, &clusterConfig{size: 3})
wAPI := pb.NewWatchClient(clus.RandConn())

Expand All @@ -436,7 +445,7 @@ func TestV3WatchCancel(t *testing.T) {
t.Fatalf("wAPI.Watch error: %v", errW)
}

if err := wStream.Send(&pb.WatchRequest{CreateRequest: &pb.WatchCreateRequest{Key: []byte("foo")}}); err != nil {
if err := wStream.Send(&pb.WatchRequest{CreateRequest: &pb.WatchCreateRequest{Key: []byte("foo"), StartRevision: startRev}}); err != nil {
t.Fatalf("wStream.Send error: %v", err)
}

Expand Down

0 comments on commit 1df5685

Please sign in to comment.