Unverified Commit f8ed752a authored by dirkmc's avatar dirkmc Committed by GitHub

fix: flaky engine peer tagging test (#287)

parent 964888c4
...@@ -1007,9 +1007,9 @@ func TestTaggingPeers(t *testing.T) { ...@@ -1007,9 +1007,9 @@ func TestTaggingPeers(t *testing.T) {
} }
func TestTaggingUseful(t *testing.T) { func TestTaggingUseful(t *testing.T) {
peerSampleInterval := 5 * time.Millisecond peerSampleInterval := 10 * time.Millisecond
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*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(8 * time.Millisecond) time.Sleep(15 * 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