mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user