Clean up log line and reduce test time.

This commit is contained in:
Ryan Breen 2014-12-18 09:00:51 -05:00
parent d82ef7bb8c
commit f2bd641402
2 changed files with 4 additions and 4 deletions

View File

@ -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 {

View File

@ -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 {