agent/checks: set critical if RPC fails
This commit is contained in:
parent
175e74972d
commit
275d2b929a
|
@ -137,6 +137,11 @@ func (c *CheckAlias) runQuery(stopCh chan struct{}) {
|
|||
var out structs.IndexedHealthChecks
|
||||
if err := c.RPC.RPC("Health.NodeChecks", &args, &out); err != nil {
|
||||
attempt++
|
||||
if attempt > 1 {
|
||||
c.Notify.UpdateCheck(c.CheckID, api.HealthCritical,
|
||||
fmt.Sprintf("Failure checking aliased node or service: %s", err))
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,12 @@ func TestCheckAlias_remoteErrBackoff(t *testing.T) {
|
|||
if got, want := atomic.LoadUint32(&rpc.Calls), uint32(6); got > want {
|
||||
t.Fatalf("got %d updates want at most %d", got, want)
|
||||
}
|
||||
|
||||
retry.Run(t, func(r *retry.R) {
|
||||
if got, want := notify.State(chkID), api.HealthCritical; got != want {
|
||||
r.Fatalf("got state %q want %q", got, want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// No remote health checks should result in passing on the check.
|
||||
|
|
Loading…
Reference in New Issue