agent: default restored checks to critical status

This commit is contained in:
Ryan Uber 2014-11-24 01:15:18 -08:00
parent 46a5272a8a
commit 79ba25b94d
2 changed files with 9 additions and 1 deletions

View File

@ -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)
})

View File

@ -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 {