From 2f93e13da8c8e312f2408c27a8d684fa412064a9 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Wed, 15 Oct 2014 10:14:46 -0700 Subject: [PATCH] consul: kill remaining use of HealthUnknown --- command/agent/agent.go | 2 +- command/agent/agent_test.go | 8 ++++---- command/agent/check.go | 4 ++-- command/agent/local_test.go | 2 +- consul/state_store.go | 2 +- consul/structs/structs.go | 1 - 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/command/agent/agent.go b/command/agent/agent.go index 418c5fef4c..b470bac346 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -437,7 +437,7 @@ func (a *Agent) AddService(service *structs.NodeService, chkType *CheckType) err Node: a.config.NodeName, CheckID: fmt.Sprintf("service:%s", service.ID), Name: fmt.Sprintf("Service '%s' check", service.Service), - Status: structs.HealthUnknown, + Status: structs.HealthCritical, Notes: "", ServiceID: service.ID, ServiceName: service.Service, diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 3343c4afc1..11f2af7616 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -186,7 +186,7 @@ func TestAgent_AddCheck(t *testing.T) { Node: "foo", CheckID: "mem", Name: "memory util", - Status: structs.HealthUnknown, + Status: structs.HealthCritical, } chk := &CheckType{ Script: "exit 0", @@ -217,7 +217,7 @@ func TestAgent_AddCheck_MinInterval(t *testing.T) { Node: "foo", CheckID: "mem", Name: "memory util", - Status: structs.HealthUnknown, + Status: structs.HealthCritical, } chk := &CheckType{ Script: "exit 0", @@ -255,7 +255,7 @@ func TestAgent_RemoveCheck(t *testing.T) { Node: "foo", CheckID: "mem", Name: "memory util", - Status: structs.HealthUnknown, + Status: structs.HealthCritical, } chk := &CheckType{ Script: "exit 0", @@ -291,7 +291,7 @@ func TestAgent_UpdateCheck(t *testing.T) { Node: "foo", CheckID: "mem", Name: "memory util", - Status: structs.HealthUnknown, + Status: structs.HealthCritical, } chk := &CheckType{ TTL: 15 * time.Second, diff --git a/command/agent/check.go b/command/agent/check.go index cf38f30cd6..dce7d8f75c 100644 --- a/command/agent/check.go +++ b/command/agent/check.go @@ -109,7 +109,7 @@ func (c *CheckMonitor) check() { cmd, err := ExecScript(c.Script) if err != nil { c.Logger.Printf("[ERR] agent: failed to setup invoke '%s': %s", c.Script, err) - c.Notify.UpdateCheck(c.CheckID, structs.HealthUnknown, err.Error()) + c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, err.Error()) return } @@ -121,7 +121,7 @@ func (c *CheckMonitor) check() { // Start the check if err := cmd.Start(); err != nil { c.Logger.Printf("[ERR] agent: failed to invoke '%s': %s", c.Script, err) - c.Notify.UpdateCheck(c.CheckID, structs.HealthUnknown, err.Error()) + c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, err.Error()) return } diff --git a/command/agent/local_test.go b/command/agent/local_test.go index 29bf379806..0fb036a1e8 100644 --- a/command/agent/local_test.go +++ b/command/agent/local_test.go @@ -172,7 +172,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) { chk2_mod := new(structs.HealthCheck) *chk2_mod = *chk2 - chk2_mod.Status = structs.HealthUnknown + chk2_mod.Status = structs.HealthCritical args.Check = chk2_mod if err := agent.RPC("Catalog.Register", args, &out); err != nil { t.Fatalf("err: %v", err) diff --git a/consul/state_store.go b/consul/state_store.go index fcb4f04ecf..7dff338f74 100644 --- a/consul/state_store.go +++ b/consul/state_store.go @@ -762,7 +762,7 @@ func (s *StateStore) EnsureCheck(index uint64, check *structs.HealthCheck) error func (s *StateStore) ensureCheckTxn(index uint64, check *structs.HealthCheck, tx *MDBTxn) error { // Ensure we have a status if check.Status == "" { - check.Status = structs.HealthUnknown + check.Status = structs.HealthCritical } // Ensure the node exists diff --git a/consul/structs/structs.go b/consul/structs/structs.go index 5b3597bba4..531a1e4b85 100644 --- a/consul/structs/structs.go +++ b/consul/structs/structs.go @@ -29,7 +29,6 @@ const ( // HealthAny is special, and is used as a wild card, // not as a specific state. HealthAny = "any" - HealthUnknown = "unknown" HealthPassing = "passing" HealthWarning = "warning" HealthCritical = "critical"