diff --git a/clientv3/integration/black_hole_test.go b/clientv3/integration/black_hole_test.go index 9db83c4cf..32d7d95e2 100644 --- a/clientv3/integration/black_hole_test.go +++ b/clientv3/integration/black_hole_test.go @@ -48,7 +48,7 @@ func TestBlackholePutWithoutKeealiveEnabled(t *testing.T) { defer cli.Close() // wait for ep[0] to be pinned - waitPinReady(t, cli) + mustWaitPinReady(t, cli) cli.SetEndpoints(clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr()) clus.Members[0].Blackhole() diff --git a/clientv3/integration/network_partition_test.go b/clientv3/integration/network_partition_test.go index 23dd1fce6..a9a865f43 100644 --- a/clientv3/integration/network_partition_test.go +++ b/clientv3/integration/network_partition_test.go @@ -78,7 +78,7 @@ func testBalancerUnderNetworkPartition(t *testing.T, op func(*clientv3.Client, c defer cli.Close() // wait for ep[0] to be pinned - waitPinReady(t, cli) + mustWaitPinReady(t, cli) // add other endpoints for later endpoint switch cli.SetEndpoints(clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr(), clus.Members[2].GRPCAddr()) @@ -139,7 +139,7 @@ func testBalancerUnderNetworkPartitionWatch(t *testing.T, isolateLeader bool) { defer watchCli.Close() // wait for eps[target] to be pinned - waitPinReady(t, watchCli) + mustWaitPinReady(t, watchCli) // add all eps to list, so that when the original pined one fails // the client can switch to other available eps diff --git a/clientv3/integration/server_shutdown_test.go b/clientv3/integration/server_shutdown_test.go index 4cfe21888..e921b30da 100644 --- a/clientv3/integration/server_shutdown_test.go +++ b/clientv3/integration/server_shutdown_test.go @@ -48,7 +48,7 @@ func TestBalancerUnderServerShutdownWatch(t *testing.T) { defer watchCli.Close() // wait for eps[lead] to be pinned - waitPinReady(t, watchCli) + mustWaitPinReady(t, watchCli) // add all eps to list, so that when the original pined one fails // the client can switch to other available eps @@ -158,7 +158,7 @@ func testBalancerUnderServerShutdownMutable(t *testing.T, op func(*clientv3.Clie defer cli.Close() // wait for eps[0] to be pinned - waitPinReady(t, cli) + mustWaitPinReady(t, cli) // add all eps to list, so that when the original pined one fails // the client can switch to other available eps @@ -216,7 +216,7 @@ func testBalancerUnderServerShutdownImmutable(t *testing.T, op func(*clientv3.Cl defer cli.Close() // wait for eps[0] to be pinned - waitPinReady(t, cli) + mustWaitPinReady(t, cli) // add all eps to list, so that when the original pined one fails // the client can switch to other available eps diff --git a/clientv3/integration/util.go b/clientv3/integration/util.go index 6cd97cc10..647c06e1f 100644 --- a/clientv3/integration/util.go +++ b/clientv3/integration/util.go @@ -22,8 +22,9 @@ import ( "github.com/coreos/etcd/clientv3" ) -// waitPinReady waits until connection is up (new pinned address). -func waitPinReady(t *testing.T, cli *clientv3.Client) { +// mustWaitPinReady waits up to 3-second until connection is up (pin endpoint). +// Fatal on time-out. +func mustWaitPinReady(t *testing.T, cli *clientv3.Client) { ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) _, err := cli.Get(ctx, "foo") cancel()