clientv3: Simplify TestDialTLSNoConfig now that dial with grpc.WithBlock correctly results in a client timeout error
@@ -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()
+ defer func() {
if c != nil {
- ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
- _, err = c.KV.Get(ctx, "/")
- cancel()
+ c.Close()
}
+ }()
if !isClientTimeout(err) {
t.Fatalf("expected dial timeout error, got %v", err)
}
+
}
// TestDialSetEndpointsBeforeFail ensures SetEndpoints can replace unavailable
