فهرست منبع

integration: update tests for new grpc reconnection interface

Anthony Romano 9 سال پیش
والد
کامیت
7abc8f21eb
2فایلهای تغییر یافته به همراه5 افزوده شده و 19 حذف شده
  1. 2 17
      integration/v3_grpc_test.go
  2. 3 2
      integration/v3_watch_test.go

+ 2 - 17
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")
 	}

+ 3 - 2
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()
 }