Browse Source

clientv3: Simplify TestDialTLSNoConfig now that dial with grpc.WithBlock correctly results in a client timeout error

Joe Betz 7 years ago
parent
commit
a2ecd6b676
1 changed files with 6 additions and 11 deletions
  1. 6 11
      clientv3/integration/dial_test.go

+ 6 - 11
clientv3/integration/dial_test.go

@@ -79,20 +79,15 @@ func TestDialTLSNoConfig(t *testing.T) {
 		DialTimeout: time.Second,
 		DialOptions: []grpc.DialOption{grpc.WithBlock()},
 	})
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer c.Close()
-
-	// TODO: this should not be required when we set grpc.WithBlock()
-	if c != nil {
-		ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
-		_, err = c.KV.Get(ctx, "/")
-		cancel()
-	}
+	defer func() {
+		if c != nil {
+			c.Close()
+		}
+	}()
 	if !isClientTimeout(err) {
 		t.Fatalf("expected dial timeout error, got %v", err)
 	}
+
 }
 
 // TestDialSetEndpointsBeforeFail ensures SetEndpoints can replace unavailable