From a2ecd6b67696367e88cbf9418ec8be89c98f3dfe Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Tue, 24 Jul 2018 10:45:03 -0700 Subject: [PATCH] clientv3: Simplify TestDialTLSNoConfig now that dial with grpc.WithBlock correctly results in a client timeout error --- clientv3/integration/dial_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/clientv3/integration/dial_test.go b/clientv3/integration/dial_test.go index e996a132b..3941de856 100644 --- a/clientv3/integration/dial_test.go +++ b/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