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