Merge pull request #5244 from hashicorp/b-template-restart-count
Fix double restart counting for templates
This commit is contained in:
commit
437520a6e6
|
@ -441,7 +441,7 @@ func (tm *TaskTemplateManager) handleTemplateRerenders(allRenderedTime time.Time
|
||||||
|
|
||||||
if restart {
|
if restart {
|
||||||
tm.config.Lifecycle.Restart(context.Background(),
|
tm.config.Lifecycle.Restart(context.Background(),
|
||||||
structs.NewTaskEvent(structs.TaskRestarting).
|
structs.NewTaskEvent(structs.TaskRestartSignal).
|
||||||
SetDisplayMessage("Template with change_mode restart re-rendered"), false)
|
SetDisplayMessage("Template with change_mode restart re-rendered"), false)
|
||||||
} else if len(signals) != 0 {
|
} else if len(signals) != 0 {
|
||||||
var mErr multierror.Error
|
var mErr multierror.Error
|
||||||
|
|
|
@ -96,7 +96,7 @@ func (tc *ConsulTemplateTest) TestUpdatesRestartTasks(f *framework.F) {
|
||||||
}
|
}
|
||||||
first := allocs[0]
|
first := allocs[0]
|
||||||
return first.TaskStates["test"].Restarts
|
return first.TaskStates["test"].Restarts
|
||||||
}, 5*time.Second, time.Second).Should(Equal(count), "Incorrect restart count")
|
}, 10*time.Second, time.Second).Should(Equal(count), "Incorrect restart count")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap in retry to wait until placement
|
// Wrap in retry to wait until placement
|
||||||
|
@ -132,10 +132,7 @@ func (tc *ConsulTemplateTest) TestUpdatesRestartTasks(f *framework.F) {
|
||||||
require.Nil(err)
|
require.Nil(err)
|
||||||
|
|
||||||
// Wrap in retry to wait until restart
|
// Wrap in retry to wait until restart
|
||||||
// TODO(dani): FIXME: This restart counter should only be 1. This is
|
waitForRestartCount(1)
|
||||||
// likely an accounting bug in restart tracking from
|
|
||||||
// template hooks.
|
|
||||||
waitForRestartCount(2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *ConsulTemplateTest) AfterEach(f *framework.F) {
|
func (tc *ConsulTemplateTest) AfterEach(f *framework.F) {
|
||||||
|
|
Loading…
Reference in a new issue