test throttle code path in gossip tracer

This commit is contained in:
vyzo 2020-09-02 22:11:42 +03:00
parent 811ca922d4
commit ec44a63c9f
1 changed files with 5 additions and 0 deletions

View File

@ -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
@ -34,6 +35,7 @@ func TestBrokenPromises(t *testing.T) {
gt.AddPromise(peerA, mids)
gt.AddPromise(peerB, mids)
gt.AddPromise(peerC, mids)
// no broken promises yet
brokenPromises := gt.GetBrokenPromises()
@ -41,6 +43,9 @@ func TestBrokenPromises(t *testing.T) {
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)