Skip to content

Commit

Permalink
Clean up log line and reduce test time.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbreen committed Dec 18, 2014
1 parent d82ef7b commit f2bd641
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion command/agent/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions command/agent/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f2bd641

Please sign in to comment.