From 4ffd8245473bff221f225a9ebad1959bde6f3db0 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 14 Dec 2016 16:18:17 -0800 Subject: [PATCH] Adds a leader wait when testing with ACLs. --- command/agent/http_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 846778ea98..540d329175 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -33,7 +33,7 @@ func makeHTTPServerWithConfig(t *testing.T, cb func(c *Config)) (string, *HTTPSe } func makeHTTPServerWithACLs(t *testing.T) (string, *HTTPServer) { - return makeHTTPServerWithConfig(t, func(c *Config) { + dir, srv := makeHTTPServerWithConfig(t, func(c *Config) { c.ACLDatacenter = c.Datacenter c.ACLDefaultPolicy = "deny" c.ACLMasterToken = "root" @@ -41,6 +41,11 @@ func makeHTTPServerWithACLs(t *testing.T) (string, *HTTPServer) { c.ACLAgentMasterToken = "towel" c.ACLEnforceVersion8 = Bool(true) }) + + // Need a leader to look up ACLs, so wait here so we don't need to + // repeat this in each test. + testutil.WaitForLeader(t, srv.agent.RPC, "dc1") + return dir, srv } func makeHTTPServerWithConfigLog(t *testing.T, cb func(c *Config), l io.Writer, logWriter *logger.LogWriter) (string, *HTTPServer) {