From fba1925345b97e7cb8ef0e7f839e7b3922559765 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Thu, 16 Feb 2017 14:48:57 -0800 Subject: [PATCH] integration: test UseLatestCluster --- clientv3/integration/dial_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clientv3/integration/dial_test.go b/clientv3/integration/dial_test.go index 01e49675cbe0..321e6d84280b 100644 --- a/clientv3/integration/dial_test.go +++ b/clientv3/integration/dial_test.go @@ -70,3 +70,21 @@ func testDialSetEndpoints(t *testing.T, setBefore bool) { } cancel() } + +func TestLatestCluster(t *testing.T) { + defer testutil.AfterTest(t) + // 2 endpoints to test multi-endpoint Status + clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 2}) + defer clus.Terminate(t) + + cfg := clientv3.Config{ + Endpoints: []string{clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr()}, + DialTimeout: 5 * time.Second, + UseLatestCluster: true, + } + cli, err := clientv3.New(cfg) + if err != nil { + t.Fatal(err) + } + cli.Close() +}