emit TaskRestartSignal event on vault restart
When Vault token expires and task is restarted, emit `TaskRestartSignal` similar to v0.8.7
This commit is contained in:
parent
8cb4bbcc08
commit
32551fb0e5
|
@ -1420,21 +1420,27 @@ func TestTaskRunner_VaultManager_Restart(t *testing.T) {
|
|||
return false, fmt.Errorf("no events yet")
|
||||
}
|
||||
|
||||
// TODO: check for RestartSignal too - 0.8 sent that event, but not 0.9
|
||||
foundRestarting := false
|
||||
foundRestartSignal, foundRestarting := false, false
|
||||
for _, e := range state.Events {
|
||||
if e.Type == structs.TaskRestarting {
|
||||
switch e.Type {
|
||||
case structs.TaskRestartSignal:
|
||||
foundRestartSignal = true
|
||||
case structs.TaskRestarting:
|
||||
foundRestarting = true
|
||||
}
|
||||
}
|
||||
|
||||
if !foundRestartSignal {
|
||||
return false, fmt.Errorf("no restart signal event yet: %#v", state.Events)
|
||||
}
|
||||
|
||||
if !foundRestarting {
|
||||
return false, fmt.Errorf("no restarting event yet: %#v", state.Events)
|
||||
}
|
||||
|
||||
lastEvent := state.Events[len(state.Events)-1]
|
||||
if lastEvent.Type != structs.TaskStarted {
|
||||
return false, fmt.Errorf("expected last event to be task restarting but was %#v", lastEvent)
|
||||
return false, fmt.Errorf("expected last event to be task starting but was %#v", lastEvent)
|
||||
}
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
|
|
|
@ -254,7 +254,7 @@ OUTER:
|
|||
case structs.VaultChangeModeRestart:
|
||||
const noFailure = false
|
||||
h.lifecycle.Restart(h.ctx,
|
||||
structs.NewTaskEvent(structs.TaskRestarting).
|
||||
structs.NewTaskEvent(structs.TaskRestartSignal).
|
||||
SetDisplayMessage("Vault: new Vault token acquired"), false)
|
||||
case structs.VaultChangeModeNoop:
|
||||
fallthrough
|
||||
|
|
Loading…
Reference in New Issue