From 8fa35216b056710689756ca1587cc0909f1cba67 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Wed, 25 Oct 2017 17:43:29 -0700 Subject: [PATCH] clientv3/integration: Get with context timeout Address https://github.com/coreos/etcd/pull/8762#discussion_r147019068. Signed-off-by: Gyu-Ho Lee --- clientv3/integration/server_shutdown_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clientv3/integration/server_shutdown_test.go b/clientv3/integration/server_shutdown_test.go index 23115e0e610..ddd49845c5c 100644 --- a/clientv3/integration/server_shutdown_test.go +++ b/clientv3/integration/server_shutdown_test.go @@ -48,7 +48,12 @@ func TestBalancerUnderServerShutdownWatch(t *testing.T) { defer watchCli.Close() // wait for eps[lead] to be pinned - watchCli.Get(context.Background(), "foo") + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + _, err = watchCli.Get(ctx, "foo") + cancel() + if err != nil { + t.Fatal(err) + } // add all eps to list, so that when the original pined one fails // the client can switch to other available eps