integration: update tests for new grpc reconnection interface

This commit is contained in:
Anthony Romano 2016-06-07 15:54:23 -07:00
parent 62f8ec25c0
commit 7abc8f21eb
2 changed files with 5 additions and 19 deletions

View File

@ -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")
}

View File

@ -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()
}