Fixed alloc dir move tests

This commit is contained in:
Diptanu Choudhury 2016-10-26 15:17:57 -07:00
parent 84722234b4
commit 1098dc4aa3
2 changed files with 11 additions and 5 deletions

View file

@ -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",

View file

@ -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}