Small fixes
This commit is contained in:
parent
117bef6515
commit
e8067029cc
|
@ -353,10 +353,11 @@ func (r *AllocRunner) Run() {
|
|||
r.logger.Printf("[DEBUG] client: alloc %q in terminal status, waiting for destroy", r.alloc.ID)
|
||||
r.handleDestroy()
|
||||
r.logger.Printf("[DEBUG] client: terminating runner for alloc '%s'", r.alloc.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// Start the task runners
|
||||
r.logger.Printf("[DEBUG] client: starting runner for alloc '%s'", r.alloc.ID)
|
||||
r.logger.Printf("[DEBUG] client: starting task runners for alloc '%s'", r.alloc.ID)
|
||||
r.taskLock.Lock()
|
||||
for _, task := range tg.Tasks {
|
||||
if _, ok := r.restored[task.Name]; ok {
|
||||
|
@ -418,7 +419,6 @@ OUTER:
|
|||
|
||||
// Destroy each sub-task
|
||||
r.taskLock.Lock()
|
||||
defer r.taskLock.Unlock()
|
||||
for _, tr := range r.tasks {
|
||||
tr.Destroy()
|
||||
}
|
||||
|
@ -427,6 +427,7 @@ OUTER:
|
|||
for _, tr := range r.tasks {
|
||||
<-tr.WaitCh()
|
||||
}
|
||||
r.taskLock.Unlock()
|
||||
|
||||
// Final state sync
|
||||
r.retrySyncState(nil)
|
||||
|
|
|
@ -114,7 +114,7 @@ func TestAllocRunner_TerminalUpdate_Destroy(t *testing.T) {
|
|||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates)
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
|
||||
// Send the destroy signal and ensure the AllocRunner cleans up.
|
||||
|
@ -147,7 +147,7 @@ func TestAllocRunner_TerminalUpdate_Destroy(t *testing.T) {
|
|||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates)
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ func TestAllocRunner_Destroy(t *testing.T) {
|
|||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates)
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
|
||||
if time.Since(start) > 15*time.Second {
|
||||
|
@ -320,6 +320,9 @@ func TestAllocRunner_SaveRestoreState_TerminalAlloc(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
// Ensure both alloc runners don't destroy
|
||||
ar.destroy = true
|
||||
|
||||
// Create a new alloc runner
|
||||
consulClient, err := NewConsulService(&consulServiceConfig{ar.logger, "127.0.0.1:8500", "", "", false, false, &structs.Node{}})
|
||||
ar2 := NewAllocRunner(ar.logger, ar.config, upd.Update,
|
||||
|
@ -376,6 +379,6 @@ func TestAllocRunner_SaveRestoreState_TerminalAlloc(t *testing.T) {
|
|||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v %#v %#v", err, upd.Allocs[0], ar.alloc.TaskStates)
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ type testFn func() (bool, error)
|
|||
type errorFn func(error)
|
||||
|
||||
func WaitForResult(test testFn, error errorFn) {
|
||||
WaitForResultRetries(1000*TestMultiplier(), test, error)
|
||||
WaitForResultRetries(2000*TestMultiplier(), test, error)
|
||||
}
|
||||
|
||||
func WaitForResultRetries(retries int64, test testFn, error errorFn) {
|
||||
|
|
Loading…
Reference in New Issue