Commit 568a984c authored by Dirk McCormick's avatar Dirk McCormick

fix: flaky test

parent 2e603424
...@@ -1009,7 +1009,7 @@ func TestTaggingPeers(t *testing.T) { ...@@ -1009,7 +1009,7 @@ func TestTaggingPeers(t *testing.T) {
func TestTaggingUseful(t *testing.T) { func TestTaggingUseful(t *testing.T) {
peerSampleInterval := 5 * time.Millisecond peerSampleInterval := 5 * time.Millisecond
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel() defer cancel()
me := newTestEngine(ctx, "engine", peerSampleInterval) me := newTestEngine(ctx, "engine", peerSampleInterval)
friend := peer.ID("friend") friend := peer.ID("friend")
...@@ -1023,7 +1023,7 @@ func TestTaggingUseful(t *testing.T) { ...@@ -1023,7 +1023,7 @@ func TestTaggingUseful(t *testing.T) {
t.Fatal("Peers should be untagged but weren't") t.Fatal("Peers should be untagged but weren't")
} }
me.Engine.MessageSent(friend, msg) me.Engine.MessageSent(friend, msg)
time.Sleep(peerSampleInterval * 2) time.Sleep(8 * time.Millisecond)
if me.PeerTagger.count(me.Engine.tagUseful) != 1 { if me.PeerTagger.count(me.Engine.tagUseful) != 1 {
t.Fatal("Peers should be tagged but weren't") t.Fatal("Peers should be tagged but weren't")
} }
......
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