diff --git a/command/agent/check.go b/command/agent/check.go index ad2c35dbd3..17e2fb5f0a 100644 --- a/command/agent/check.go +++ b/command/agent/check.go @@ -95,7 +95,7 @@ func (c *CheckMonitor) Stop() { func (c *CheckMonitor) run() { // Get the randomized initial pause time initialPauseTime := randomStagger(c.Interval) - c.Logger.Printf("[DEBUG] agent: pausing %ds before first invocation of %s", int(initialPauseTime.Seconds()), c.Script) + c.Logger.Printf("[DEBUG] agent: pausing %v before first invocation of %s", initialPauseTime, c.Script) next := time.After(initialPauseTime) for { select { diff --git a/command/agent/check_test.go b/command/agent/check_test.go index 62cbafb7c4..6a6f80afc3 100644 --- a/command/agent/check_test.go +++ b/command/agent/check_test.go @@ -75,17 +75,17 @@ func TestCheckMonitor_RandomStagger(t *testing.T) { Notify: mock, CheckID: "foo", Script: "exit 0", - Interval: 5 * time.Second, + Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), } check.Start() defer check.Stop() - time.Sleep(6 * time.Second) + time.Sleep(50 * time.Millisecond) // Should have at least 1 update if mock.updates["foo"] < 1 { - t.Fatalf("should have 1 updates %v", mock.updates) + t.Fatalf("should have 1 or more updates %v", mock.updates) } if mock.state["foo"] != structs.HealthPassing {