From 26c8a9ad4cdef15fd10e1200a0526c5775172e84 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Tue, 4 Jul 2017 22:07:00 -0700 Subject: [PATCH] Adds a temporary band-aid to the API tests. Once we can run the agent directly in-process with random ports from the kernel, and the special retry just in memberlist, we shouldn't need this. --- testutil/server.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/testutil/server.go b/testutil/server.go index 47a3342a0..4b785d036 100644 --- a/testutil/server.go +++ b/testutil/server.go @@ -190,6 +190,19 @@ func NewTestServerConfig(cb ServerConfigCallback) (*TestServer, error) { // configuring or starting the server, the server will NOT be running when the // function returns (thus you do not need to stop it). func NewTestServerConfigT(t *testing.T, cb ServerConfigCallback) (*TestServer, error) { + var server *TestServer + retry.Run(t, func(r *retry.R) { + var err error + server, err = newTestServerConfigT(t, cb) + if err != nil { + r.Fatalf("failed starting test server: %v", err) + } + }) + return server, nil +} + +// newTestServerConfigT is the internal helper for NewTestServerConfigT. +func newTestServerConfigT(t *testing.T, cb ServerConfigCallback) (*TestServer, error) { path, err := exec.LookPath("consul") if err != nil || path == "" { return nil, fmt.Errorf("consul not found on $PATH - download and install " +