From 7abc8f21ebf53c057f35b9a2d5b55990d5ebcf35 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Tue, 7 Jun 2016 15:54:23 -0700 Subject: [PATCH] integration: update tests for new grpc reconnection interface --- integration/v3_grpc_test.go | 19 ++----------------- integration/v3_watch_test.go | 5 +++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/integration/v3_grpc_test.go b/integration/v3_grpc_test.go index 1cefdc759..f5d56175b 100644 --- a/integration/v3_grpc_test.go +++ b/integration/v3_grpc_test.go @@ -909,30 +909,15 @@ func TestTLSGRPCRejectInsecureClient(t *testing.T) { } defer client.Close() - ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second) - conn := client.ActiveConnection() - st, err := conn.State() - if err != nil { - t.Fatal(err) - } else if st != grpc.Ready { - t.Fatalf("expected Ready, got %v", st) - } - - // rpc will fail to handshake, triggering a connection state change donec := make(chan error, 1) go func() { + ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second) reqput := &pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")} _, perr := toGRPC(client).KV.Put(ctx, reqput) + cancel() donec <- perr }() - st, err = conn.WaitForStateChange(ctx, st) - if err != nil { - t.Fatalf("unexpected error waiting for change (%v)", err) - } else if st == grpc.Ready { - t.Fatalf("expected failure state, got %v", st) - } - cancel() if perr := <-donec; perr == nil { t.Fatalf("expected client error on put") } diff --git a/integration/v3_watch_test.go b/integration/v3_watch_test.go index c2aa51826..a3181506c 100644 --- a/integration/v3_watch_test.go +++ b/integration/v3_watch_test.go @@ -983,7 +983,7 @@ func TestV3WatchClose(t *testing.T) { clus := NewClusterV3(t, &ClusterConfig{Size: 1}) defer clus.Terminate(t) - c := clus.RandClient() + c := clus.Client(0) wapi := toGRPC(c).Watch var wg sync.WaitGroup @@ -1007,6 +1007,7 @@ func TestV3WatchClose(t *testing.T) { ws.Recv() }() } - c.ActiveConnection().Close() + + clus.Members[0].DropConnections() wg.Wait() }