diff --git a/client/alloc_runner_test.go b/client/alloc_runner_test.go index 2644dc23d..9f4960671 100644 --- a/client/alloc_runner_test.go +++ b/client/alloc_runner_test.go @@ -554,7 +554,7 @@ func TestAllocRunner_MoveAllocDir(t *testing.T) { // Create another alloc runner alloc1 := mock.Alloc() - task = alloc.Job.TaskGroups[0].Tasks[0] + task = alloc1.Job.TaskGroups[0].Tasks[0] task.Driver = "mock_driver" task.Config = map[string]interface{}{ "run_for": "1s", diff --git a/client/allocdir/alloc_dir_test.go b/client/allocdir/alloc_dir_test.go index f90d864b5..948253865 100644 --- a/client/allocdir/alloc_dir_test.go +++ b/client/allocdir/alloc_dir_test.go @@ -292,17 +292,23 @@ func TestAllocDir_Snapshot(t *testing.T) { } func TestAllocDir_Move(t *testing.T) { - tmp, err := ioutil.TempDir("", "AllocDir") + tmp1, err := ioutil.TempDir("", "AllocDir") if err != nil { t.Fatalf("Couldn't create temp dir: %v", err) } - defer os.RemoveAll(tmp) + defer os.RemoveAll(tmp1) + + tmp2, err := ioutil.TempDir("", "AllocDir") + if err != nil { + t.Fatalf("Couldn't create temp dir: %v", err) + } + defer os.RemoveAll(tmp2) // Create two alloc dirs - d1 := NewAllocDir(tmp) + d1 := NewAllocDir(tmp1) defer d1.Destroy() - d2 := NewAllocDir(tmp) + d2 := NewAllocDir(tmp2) defer d2.Destroy() tasks := []*structs.Task{t1, t2}