Fixup a few more even rarer test races

This commit is contained in:
Michael Schurter 2017-07-21 13:43:32 -07:00
parent 38cb2021dd
commit b9ba447399
1 changed files with 8 additions and 4 deletions

View File

@ -629,7 +629,8 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
return last.ClientStatus == structs.AllocClientStatusRunning, nil return last.ClientStatus == structs.AllocClientStatusRunning, nil
}, func(err error) { }, func(err error) {
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar2.alloc.TaskStates["web"]) _, last := upd.Last()
t.Fatalf("err: %v %#v %#v", err, last, last.TaskStates["web"])
}) })
// Destroy and wait // Destroy and wait
@ -643,7 +644,8 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
} }
return true, nil return true, nil
}, func(err error) { }, func(err error) {
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates) _, last := upd.Last()
t.Fatalf("err: %v %#v %#v", err, last, last.TaskStates)
}) })
if time.Since(start) > time.Duration(testutil.TestMultiplier()*5)*time.Second { if time.Since(start) > time.Duration(testutil.TestMultiplier()*5)*time.Second {
@ -728,7 +730,8 @@ func TestAllocRunner_SaveRestoreState_TerminalAlloc(t *testing.T) {
return true, nil return true, nil
}, func(err error) { }, func(err error) {
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates) _, last := upd.Last()
t.Fatalf("err: %v %#v %#v", err, last, last.TaskStates)
}) })
// Send the destroy signal and ensure the AllocRunner cleans up. // Send the destroy signal and ensure the AllocRunner cleans up.
@ -845,7 +848,8 @@ func TestAllocRunner_SaveRestoreState_Upgrade(t *testing.T) {
} }
return true, nil return true, nil
}, func(err error) { }, func(err error) {
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates) _, last := upd.Last()
t.Fatalf("err: %v %#v %#v", err, last, last.TaskStates)
}) })
if time.Since(start) > time.Duration(testutil.TestMultiplier()*5)*time.Second { if time.Since(start) > time.Duration(testutil.TestMultiplier()*5)*time.Second {