testutil: enable dev mode using a config flag.

This flag is not normally supported in Nomad, but we really need
to use it for testing to lower the timing values for registration
retries et. al. Instead of just enabling it on all tests, we
provide a bool flag in the config, which just makes the test
server pass the extra CLI arg when true.
This commit is contained in:
Ryan Uber 2015-09-11 21:25:46 -07:00
parent 6e10bd8af4
commit 086e1d9daa
1 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,7 @@ type TestServerConfig struct {
Ports *PortsConfig `json:"ports,omitempty"`
Server *ServerConfig `json:"server,omitempty"`
Client *ClientConfig `json:"client,omitempty"`
DevMode bool `json:"-"`
Stdout, Stderr io.Writer `json:"-"`
}
@ -142,8 +143,13 @@ func NewTestServer(t *testing.T, cb ServerConfigCallback) *TestServer {
stderr = nomadConfig.Stderr
}
args := []string{"agent", "-config", configFile.Name()}
if nomadConfig.DevMode {
args = append(args, "-dev")
}
// Start the server
cmd := exec.Command("nomad", "agent", "-dev", "-config", configFile.Name())
cmd := exec.Command("nomad", args...)
cmd.Stdout = stdout
cmd.Stderr = stderr
if err := cmd.Start(); err != nil {