mirror of https://github.com/status-im/consul.git
agent: default restored checks to critical status
This commit is contained in:
parent
46a5272a8a
commit
79ba25b94d
|
@ -617,6 +617,10 @@ func (a *Agent) restoreChecks() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Default check to critical to avoid placing potentially unhealthy
|
||||
// services into the active pool
|
||||
check.Status = structs.HealthCritical
|
||||
|
||||
a.logger.Printf("[DEBUG] Restored health check: %s", check.CheckID)
|
||||
return a.AddCheck(check, nil)
|
||||
})
|
||||
|
|
|
@ -480,9 +480,13 @@ func TestAgent_PersistCheck(t *testing.T) {
|
|||
}
|
||||
defer agent2.Shutdown()
|
||||
|
||||
if _, ok := agent2.state.checks[check.CheckID]; !ok {
|
||||
result, ok := agent2.state.checks[check.CheckID]
|
||||
if !ok {
|
||||
t.Fatalf("bad: %#v", agent2.state.checks)
|
||||
}
|
||||
if result.Status != structs.HealthCritical {
|
||||
t.Fatalf("bad: %#v", result)
|
||||
}
|
||||
|
||||
// Should remove the service file
|
||||
if err := agent2.RemoveCheck(check.CheckID); err != nil {
|
||||
|
|
Loading…
Reference in New Issue