mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
fix flaky test by allowing for call invocation overhead
This commit is contained in:
@@ -886,9 +886,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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user