mirror of https://github.com/hashicorp/consul
agent/checks: set critical if RPC fails
parent
e9914ee71c
commit
1e9233eec1
|
@ -137,6 +137,11 @@ func (c *CheckAlias) runQuery(stopCh chan struct{}) {
|
||||||
var out structs.IndexedHealthChecks
|
var out structs.IndexedHealthChecks
|
||||||
if err := c.RPC.RPC("Health.NodeChecks", &args, &out); err != nil {
|
if err := c.RPC.RPC("Health.NodeChecks", &args, &out); err != nil {
|
||||||
attempt++
|
attempt++
|
||||||
|
if attempt > 1 {
|
||||||
|
c.Notify.UpdateCheck(c.CheckID, api.HealthCritical,
|
||||||
|
fmt.Sprintf("Failure checking aliased node or service: %s", err))
|
||||||
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,12 @@ func TestCheckAlias_remoteErrBackoff(t *testing.T) {
|
||||||
if got, want := atomic.LoadUint32(&rpc.Calls), uint32(6); got > want {
|
if got, want := atomic.LoadUint32(&rpc.Calls), uint32(6); got > want {
|
||||||
t.Fatalf("got %d updates want at most %d", 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.
|
// No remote health checks should result in passing on the check.
|
||||||
|
|
Loading…
Reference in New Issue