From 480c189d9afa27f41d6b134a46b2afd700df42a7 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Fri, 8 May 2015 18:16:35 -0700 Subject: [PATCH] testutil: key leader wait on bootstrap flag --- testutil/README.md | 3 +-- testutil/server.go | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/testutil/README.md b/testutil/README.md index a0fe2bedd6..ebbbade5dc 100644 --- a/testutil/README.md +++ b/testutil/README.md @@ -29,10 +29,9 @@ func TestMain(t *testing.T) { defer srv1.Stop() // Create a secondary server, passing in configuration - // to avoid bootstrapping or waiting for a leader. + // to avoid bootstrapping as we are forming a cluster. srv2 := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) { c.Bootstrap = false - c.NoLeaderWait = true }) defer srv2.Stop() diff --git a/testutil/server.go b/testutil/server.go index b70fee9c8d..1b0f1b2693 100644 --- a/testutil/server.go +++ b/testutil/server.go @@ -59,11 +59,6 @@ type TestServerConfig struct { Bind string `json:"bind_addr,omitempty"` Addresses *TestAddressConfig `json:"addresses,omitempty"` Ports *TestPortConfig `json:"ports,omitempty"` - - // NoLeaderWait is a special config option used to instruct - // the test harness not to wait for a leader. Useful for - // bootstrapping a multi-node cluster for testing. - NoLeaderWait bool `json:"-"` } // ServerConfigCallback is a function interface which can be @@ -207,10 +202,10 @@ func NewTestServerConfig(t *testing.T, cb ServerConfigCallback) *TestServer { } // Wait for the server to be ready - if consulConfig.NoLeaderWait { - server.waitForAPI() - } else { + if consulConfig.Bootstrap { server.waitForLeader() + } else { + server.waitForAPI() } return server