Unverified Commit 9bf0f256 authored by dirkmc's avatar dirkmc Committed by GitHub

fix: flaky TestDontHaveTimeoutMgrTimeout (#320)

parent 9b89a3b1
...@@ -71,7 +71,7 @@ func (tr *timeoutRecorder) clear() { ...@@ -71,7 +71,7 @@ func (tr *timeoutRecorder) clear() {
func TestDontHaveTimeoutMgrTimeout(t *testing.T) { func TestDontHaveTimeoutMgrTimeout(t *testing.T) {
firstks := testutil.GenerateCids(2) firstks := testutil.GenerateCids(2)
secondks := append(firstks, testutil.GenerateCids(3)...) secondks := append(firstks, testutil.GenerateCids(3)...)
latency := time.Millisecond * 10 latency := time.Millisecond * 20
latMultiplier := 2 latMultiplier := 2
expProcessTime := 5 * time.Millisecond expProcessTime := 5 * time.Millisecond
expectedTimeout := expProcessTime + latency*time.Duration(latMultiplier) expectedTimeout := expProcessTime + latency*time.Duration(latMultiplier)
...@@ -87,7 +87,7 @@ func TestDontHaveTimeoutMgrTimeout(t *testing.T) { ...@@ -87,7 +87,7 @@ func TestDontHaveTimeoutMgrTimeout(t *testing.T) {
dhtm.AddPending(firstks) dhtm.AddPending(firstks)
// Wait for less than the expected timeout // Wait for less than the expected timeout
time.Sleep(expectedTimeout - 5*time.Millisecond) time.Sleep(expectedTimeout - 10*time.Millisecond)
// At this stage no keys should have timed out // At this stage no keys should have timed out
if tr.timedOutCount() > 0 { if tr.timedOutCount() > 0 {
...@@ -98,7 +98,7 @@ func TestDontHaveTimeoutMgrTimeout(t *testing.T) { ...@@ -98,7 +98,7 @@ func TestDontHaveTimeoutMgrTimeout(t *testing.T) {
dhtm.AddPending(secondks) dhtm.AddPending(secondks)
// Wait until after the expected timeout // Wait until after the expected timeout
time.Sleep(10 * time.Millisecond) time.Sleep(20 * time.Millisecond)
// At this stage first set of keys should have timed out // At this stage first set of keys should have timed out
if tr.timedOutCount() != len(firstks) { if tr.timedOutCount() != len(firstks) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment