mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: Simplify TestDialTLSNoConfig now that dial with grpc.WithBlock correctly results in a client timeout error
This commit is contained in:
parent
b3b06a862a
commit
a2ecd6b676
@ -79,20 +79,15 @@ func TestDialTLSNoConfig(t *testing.T) {
|
|||||||
DialTimeout: time.Second,
|
DialTimeout: time.Second,
|
||||||
DialOptions: []grpc.DialOption{grpc.WithBlock()},
|
DialOptions: []grpc.DialOption{grpc.WithBlock()},
|
||||||
})
|
})
|
||||||
if err != nil {
|
defer func() {
|
||||||
t.Fatal(err)
|
if c != nil {
|
||||||
}
|
c.Close()
|
||||||
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()
|
|
||||||
}
|
|
||||||
if !isClientTimeout(err) {
|
if !isClientTimeout(err) {
|
||||||
t.Fatalf("expected dial timeout error, got %v", err)
|
t.Fatalf("expected dial timeout error, got %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestDialSetEndpointsBeforeFail ensures SetEndpoints can replace unavailable
|
// TestDialSetEndpointsBeforeFail ensures SetEndpoints can replace unavailable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user