From 8af424fc4cd80750a8300ff3e40689260522fe86 Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Mon, 26 May 2014 13:13:56 -0700 Subject: [PATCH 1/2] tests: Don't generate binary output from checks. The tests will end up logging the check output, and spewing random binary all over a terminal never results in anything good. --- command/agent/check_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/agent/check_test.go b/command/agent/check_test.go index 07b4f598d7..19e087c67e 100644 --- a/command/agent/check_test.go +++ b/command/agent/check_test.go @@ -74,7 +74,7 @@ func TestCheckMonitor_LimitOutput(t *testing.T) { check := &CheckMonitor{ Notify: mock, CheckID: "foo", - Script: "dd if=/dev/urandom bs=8192 count=10", + Script: "od -N 81920 /dev/urandom", Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), } From 2080122f383af744d59c9fcc9d64a16f950a92c0 Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Mon, 26 May 2014 13:26:42 -0700 Subject: [PATCH 2/2] WaitForLeader: Also wait for a non-zero index. On my laptop, I'm currently seeing a huge number of intermittent test failures all related to WaitForLeader returning after the test node has become a leader, but before it has actually finished starting up, in particular, performing the serf/Raft reconciliation. Waiting for the index to become nonzero makes the tests pass reliably, by also blocking until the new leader has started committing state. --- testutil/wait.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutil/wait.go b/testutil/wait.go index 0bf40937ad..402553352f 100644 --- a/testutil/wait.go +++ b/testutil/wait.go @@ -36,7 +36,7 @@ func WaitForLeader(t *testing.T, rpc rpcFn, dc string) structs.IndexedNodes { Datacenter: dc, } err := rpc("Catalog.ListNodes", args, &out) - return out.QueryMeta.KnownLeader, err + return out.QueryMeta.KnownLeader && out.Index > 0, err }, func(err error) { t.Fatalf("failed to find leader: %v", err) })