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

This commit is contained in:
Joe Betz 2018-07-24 10:45:03 -07:00
parent b3b06a862a
commit a2ecd6b676
No known key found for this signature in database
GPG Key ID: 4930C680B6E0DDB8

View File

@ -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