Skip to content

Commit

Permalink
Merge pull request #5668 from hashicorp/flaky-test-20190430
Browse files Browse the repository at this point in the history
fix flaky test by allowing for call invocation overhead
  • Loading branch information
Mahmood Ali committed May 13, 2019
2 parents a732cd1 + 538b5c3 commit 1211435
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions command/agent/consul/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,10 @@ func TestConsul_ShutdownSlow(t *testing.T) {
t.Errorf("unexpected error shutting down client: %v", err)
}

// Shutdown time should have taken: 1s <= shutdown <= 3s
// Shutdown time should have taken: ~1s <= shutdown <= 3s
// actual timing might be less than 1s, to account for shutdown invocation overhead
shutdownTime := time.Now().Sub(preShutdown)
if shutdownTime < time.Second || shutdownTime > ctx.ServiceClient.shutdownWait {
if shutdownTime < 900*time.Millisecond || shutdownTime > ctx.ServiceClient.shutdownWait {
t.Errorf("expected shutdown to take >1s and <%s but took: %s", ctx.ServiceClient.shutdownWait, shutdownTime)
}

Expand Down

0 comments on commit 1211435

Please sign in to comment.