mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Fix TestAllocRunner_SaveRestoreState
This commit is contained in:
@@ -321,7 +321,8 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create a new alloc runner
|
||||
ar2 := NewAllocRunner(ar.logger, ar.config, upd.Update,
|
||||
l2 := prefixedTestLogger("----- ar2: ")
|
||||
ar2 := NewAllocRunner(l2, ar.config, upd.Update,
|
||||
&structs.Allocation{ID: ar.alloc.ID}, ar.vaultClient)
|
||||
err = ar2.RestoreState()
|
||||
if err != nil {
|
||||
@@ -341,7 +342,7 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
|
||||
last := upd.Allocs[upd.Count-1]
|
||||
return last.ClientStatus == structs.AllocClientStatusRunning, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates)
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar2.alloc.TaskStates["web"])
|
||||
})
|
||||
|
||||
// Destroy and wait
|
||||
|
||||
@@ -1212,8 +1212,13 @@ func (r *TaskRunner) buildTaskDir(fsi cstructs.FSIsolation) error {
|
||||
built := r.taskDirBuilt
|
||||
r.persistLock.Unlock()
|
||||
|
||||
r.setState(structs.TaskStatePending, structs.NewTaskEvent(structs.TaskSetup).
|
||||
SetMessage(structs.TaskBuildingTaskDir))
|
||||
// We do not set the state again since this only occurs during restoration
|
||||
// and the task dir is already built. The reason we call Build again is to
|
||||
// ensure that the task dir invariants are still held.
|
||||
if !built {
|
||||
r.setState(structs.TaskStatePending, structs.NewTaskEvent(structs.TaskSetup).
|
||||
SetMessage(structs.TaskBuildingTaskDir))
|
||||
}
|
||||
|
||||
chroot := config.DefaultChrootEnv
|
||||
if len(r.config.ChrootEnv) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user