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.
This commit is contained in:
James Phillips 2017-07-04 22:07:00 -07:00 committed by Frank Schröder
parent 7b54e325df
commit 26c8a9ad4c
1 changed files with 13 additions and 0 deletions

View File

@ -190,6 +190,19 @@ func NewTestServerConfig(cb ServerConfigCallback) (*TestServer, error) {
// configuring or starting the server, the server will NOT be running when the // configuring or starting the server, the server will NOT be running when the
// function returns (thus you do not need to stop it). // function returns (thus you do not need to stop it).
func NewTestServerConfigT(t *testing.T, cb ServerConfigCallback) (*TestServer, error) { 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") path, err := exec.LookPath("consul")
if err != nil || path == "" { if err != nil || path == "" {
return nil, fmt.Errorf("consul not found on $PATH - download and install " + return nil, fmt.Errorf("consul not found on $PATH - download and install " +