diff --git a/client/alloc_runner_test.go b/client/alloc_runner_test.go index f1bc828b807..2c1028704eb 100644 --- a/client/alloc_runner_test.go +++ b/client/alloc_runner_test.go @@ -32,6 +32,7 @@ func (m *MockAllocStateUpdater) Update(alloc *structs.Allocation) { func testAllocRunnerFromAlloc(alloc *structs.Allocation, restarts bool) (*MockAllocStateUpdater, *AllocRunner) { logger := testLogger() conf := config.DefaultConfig() + conf.Node = mock.Node() conf.StateDir = os.TempDir() conf.AllocDir = os.TempDir() upd := &MockAllocStateUpdater{} diff --git a/client/driver/driver_test.go b/client/driver/driver_test.go index c64ee1e7943..21fcd1eb354 100644 --- a/client/driver/driver_test.go +++ b/client/driver/driver_test.go @@ -74,6 +74,8 @@ func testConfig() *config.Config { conf.StateDir = os.TempDir() conf.AllocDir = os.TempDir() conf.MaxKillTimeout = 10 * time.Second + conf.Region = "global" + conf.Node = mock.Node() return conf } @@ -163,7 +165,7 @@ func setupTaskEnv(t *testing.T, driver string) (*allocdir.TaskDir, map[string]st conf := testConfig() allocDir := allocdir.NewAllocDir(testLogger(), filepath.Join(conf.AllocDir, alloc.ID)) taskDir := allocDir.NewTaskDir(task.Name) - env, err := GetTaskEnv(taskDir, nil, task, alloc, conf, "") + env, err := GetTaskEnv(taskDir, conf.Node, task, alloc, conf, "") if err != nil { t.Fatalf("GetTaskEnv() failed: %v", err) } @@ -210,6 +212,8 @@ func setupTaskEnv(t *testing.T, driver string) (*allocdir.TaskDir, map[string]st "NOMAD_ALLOC_NAME": alloc.Name, "NOMAD_TASK_NAME": task.Name, "NOMAD_JOB_NAME": alloc.Job.Name, + "NOMAD_DC": "dc1", + "NOMAD_REGION": "global", } act := env.EnvMap() diff --git a/client/task_runner_test.go b/client/task_runner_test.go index ede8cb1647c..cabc13799ba 100644 --- a/client/task_runner_test.go +++ b/client/task_runner_test.go @@ -74,6 +74,7 @@ func testTaskRunner(t *testing.T, restarts bool) *taskRunnerTestCtx { func testTaskRunnerFromAlloc(t *testing.T, restarts bool, alloc *structs.Allocation) *taskRunnerTestCtx { logger := testLogger() conf := config.DefaultConfig() + conf.Node = mock.Node() conf.StateDir = os.TempDir() conf.AllocDir = os.TempDir() upd := &MockTaskStateUpdater{} diff --git a/command/agent/consul/int_test.go b/command/agent/consul/int_test.go index 9243b5822e1..764f9fd4607 100644 --- a/command/agent/consul/int_test.go +++ b/command/agent/consul/int_test.go @@ -54,6 +54,7 @@ func TestConsul_Integration(t *testing.T) { defer testconsul.Stop() conf := config.DefaultConfig() + conf.Node = mock.Node() conf.ConsulConfig.Addr = testconsul.HTTPAddr consulConfig, err := conf.ConsulConfig.ApiConfig() if err != nil {