agent: Default health checks to critical. Fixes #341
This commit is contained in:
parent
80a77a82df
commit
967cc6d701
|
@ -46,7 +46,7 @@ func (c *CheckDefinition) HealthCheck(node string) *structs.HealthCheck {
|
|||
Node: node,
|
||||
CheckID: c.ID,
|
||||
Name: c.Name,
|
||||
Status: structs.HealthUnknown,
|
||||
Status: structs.HealthCritical,
|
||||
Notes: c.Notes,
|
||||
}
|
||||
if health.CheckID == "" && health.Name != "" {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package agent
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAgentStructs_HealthCheck(t *testing.T) {
|
||||
def := CheckDefinition{}
|
||||
check := def.HealthCheck("node1")
|
||||
|
||||
// Health checks default to critical state
|
||||
if check.Status != structs.HealthCritical {
|
||||
t.Fatalf("bad: %v", check.Status)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue