diff --git a/command/agent/agent.go b/command/agent/agent.go index 16d1b741a5..d1d9e92915 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -761,7 +761,7 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType, persist } // Restore persisted state, if any - if err := a.recallCheckState(check); err != nil { + if err := a.loadCheckState(check); err != nil { a.logger.Printf("[WARN] agent: failed restoring state for check %q: %s", check.CheckID, err) } @@ -917,8 +917,8 @@ func (a *Agent) persistCheckState(check *CheckTTL, status, output string) error return nil } -// recallCheckState is used to restore the persisted state of a check. -func (a *Agent) recallCheckState(check *structs.HealthCheck) error { +// loadCheckState is used to restore the persisted state of a check. +func (a *Agent) loadCheckState(check *structs.HealthCheck) error { // Try to read the persisted state for this check file := filepath.Join(a.config.DataDir, checkStateDir, stringHash(check.CheckID)) buf, err := ioutil.ReadFile(file) diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index bb21464c72..b36a8a2741 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -1441,7 +1441,7 @@ func TestAgent_persistCheckState(t *testing.T) { } } -func TestAgent_recallCheckState(t *testing.T) { +func TestAgent_loadCheckState(t *testing.T) { config := nextConfig() dir, agent := makeAgent(t, config) defer os.RemoveAll(dir) @@ -1459,12 +1459,12 @@ func TestAgent_recallCheckState(t *testing.T) { t.Fatalf("err: %s", err) } - // Try to recall the state + // Try to load the state health := &structs.HealthCheck{ CheckID: "check1", Status: structs.HealthCritical, } - if err := agent.recallCheckState(health); err != nil { + if err := agent.loadCheckState(health); err != nil { t.Fatalf("err: %s", err) } @@ -1489,8 +1489,8 @@ func TestAgent_recallCheckState(t *testing.T) { t.Fatalf("err: %s", err) } - // Try to recall - if err := agent.recallCheckState(health); err != nil { + // Try to load + if err := agent.loadCheckState(health); err != nil { t.Fatalf("err: %s", err) }