diff --git a/command/agent/structs.go b/command/agent/structs.go index 2370c3936a..e202823710 100644 --- a/command/agent/structs.go +++ b/command/agent/structs.go @@ -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 != "" { diff --git a/command/agent/structs_test.go b/command/agent/structs_test.go new file mode 100644 index 0000000000..f21f69fd74 --- /dev/null +++ b/command/agent/structs_test.go @@ -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) + } +}