Skip to content

Commit

Permalink
agent: Default health checks to critical. Fixes #341
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanuber committed Oct 15, 2014
1 parent cc999e3 commit f311ada
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion command/agent/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
16 changes: 16 additions & 0 deletions command/agent/structs_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit f311ada

Please sign in to comment.