Skip to content

Commit

Permalink
test throttle code path in gossip tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Sep 7, 2020
1 parent 811ca92 commit ec44a63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gossip_tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestBrokenPromises(t *testing.T) {

peerA := peer.ID("A")
peerB := peer.ID("B")
peerC := peer.ID("C")

var msgs []*pb.Message
var mids []string
Expand All @@ -34,13 +35,17 @@ func TestBrokenPromises(t *testing.T) {

gt.AddPromise(peerA, mids)
gt.AddPromise(peerB, mids)
gt.AddPromise(peerC, mids)

// no broken promises yet
brokenPromises := gt.GetBrokenPromises()
if brokenPromises != nil {
t.Fatal("expected no broken promises")
}

// throttle one of the peers to save his promises
gt.ThrottlePeer(peerC)

// make promises break
time.Sleep(GossipSubIWantFollowupTime + 10*time.Millisecond)

Expand Down

0 comments on commit ec44a63

Please sign in to comment.