Commit 3be2da86 authored by Dirk McCormick's avatar Dirk McCormick

test: fix flaky tests

parent 1c24de2c
......@@ -394,9 +394,9 @@ func TestWantlistRebroadcast(t *testing.T) {
t.Fatal("wrong number of wants")
}
// Tell message queue to rebroadcast after 5ms, then wait 8ms
messageQueue.SetRebroadcastInterval(5 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 8*time.Millisecond)
// Tell message queue to rebroadcast after 10ms, then wait 15ms
messageQueue.SetRebroadcastInterval(10 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 15*time.Millisecond)
firstMessage = messages[0]
// Both original and new wants should have been rebroadcast
......@@ -425,9 +425,9 @@ func TestWantlistRebroadcast(t *testing.T) {
}
}
// Tell message queue to rebroadcast after 5ms, then wait 8ms
messageQueue.SetRebroadcastInterval(5 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 8*time.Millisecond)
// Tell message queue to rebroadcast after 10ms, then wait 15ms
messageQueue.SetRebroadcastInterval(10 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 15*time.Millisecond)
firstMessage = messages[0]
if len(firstMessage.Wantlist()) != totalWants-len(cancels) {
t.Fatal("did not rebroadcast all wants")
......
......@@ -481,7 +481,7 @@ func TestConsecutiveDontHaveLimit(t *testing.T) {
spm.Update(p, []cid.Cid{}, cids[:1], []cid.Cid{})
// Wait for processing to complete
time.Sleep(5 * time.Millisecond)
time.Sleep(10 * time.Millisecond)
// Peer should be available
if has := fpm.HasPeer(p); !has {
......@@ -495,7 +495,7 @@ func TestConsecutiveDontHaveLimit(t *testing.T) {
}
// Wait for processing to complete
time.Sleep(5 * time.Millisecond)
time.Sleep(20 * time.Millisecond)
// Peer should be available
if has := fpm.HasPeer(p); !has {
......@@ -509,7 +509,7 @@ func TestConsecutiveDontHaveLimit(t *testing.T) {
}
// Wait for processing to complete
time.Sleep(5 * time.Millisecond)
time.Sleep(20 * time.Millisecond)
// Session should remove peer
if has := fpm.HasPeer(p); has {
......
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