From 7d3ac07f89b46b42ad2019d52db747d4072136b0 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 14 Nov 2017 10:46:18 -0800 Subject: [PATCH] clientv3/integration: fix TestSetEndpointAndPut dial tests Signed-off-by: Gyu-Ho Lee --- clientv3/integration/dial_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clientv3/integration/dial_test.go b/clientv3/integration/dial_test.go index 43145c2cbb0..adc58f1a399 100644 --- a/clientv3/integration/dial_test.go +++ b/clientv3/integration/dial_test.go @@ -191,7 +191,8 @@ func TestDialForeignEndpoint(t *testing.T) { } // TestSetEndpointAndPut checks that a Put following a SetEndpoints -// to a working endpoint will always succeed. +// to a working endpoint succeeds with the new endpoint or returns +// gRPC transport errors. func TestSetEndpointAndPut(t *testing.T) { defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 2}) @@ -199,7 +200,10 @@ func TestSetEndpointAndPut(t *testing.T) { clus.Client(1).SetEndpoints(clus.Members[0].GRPCAddr()) _, err := clus.Client(1).Put(context.TODO(), "foo", "bar") - if err != nil && !strings.Contains(err.Error(), "closing") { + // grpc/transport.ErrConnClosing or grpc/transport.ErrConnDrain on balancer endpoint switch + if err != nil && + !strings.Contains(err.Error(), "transport is closing") && + !strings.Contains(err.Error(), "the server stops accepting new RPCs") { t.Fatal(err) } }