mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26662 from WeiZhang555/fix-flaky-unit-test
Fix flaky unit test
This commit is contained in:
commit
56952e2159
1 changed files with 2 additions and 2 deletions
|
@ -47,14 +47,14 @@ func testHTTPTimeout(t *testing.T, timeout, epsilon time.Duration) {
|
|||
t.Fatalf("The request should be canceled %v", err)
|
||||
}
|
||||
elapsed := time.Now().Sub(begin)
|
||||
if elapsed < timeout || elapsed > timeout+epsilon {
|
||||
if elapsed < timeout-epsilon || elapsed > timeout+epsilon {
|
||||
t.Fatalf("elapsed time: got %v, expected %v (epsilon=%v)",
|
||||
elapsed, timeout, epsilon)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTTPTimeout(t *testing.T) {
|
||||
testHTTPTimeout(t, 5*time.Second, 1*time.Second)
|
||||
testHTTPTimeout(t, 5*time.Second, 500*time.Millisecond)
|
||||
}
|
||||
|
||||
func TestFailedConnection(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue