test throttle code path in gossip tracer
This commit is contained in:
parent
811ca922d4
commit
ec44a63c9f
|
@ -21,6 +21,7 @@ func TestBrokenPromises(t *testing.T) {
|
||||||
|
|
||||||
peerA := peer.ID("A")
|
peerA := peer.ID("A")
|
||||||
peerB := peer.ID("B")
|
peerB := peer.ID("B")
|
||||||
|
peerC := peer.ID("C")
|
||||||
|
|
||||||
var msgs []*pb.Message
|
var msgs []*pb.Message
|
||||||
var mids []string
|
var mids []string
|
||||||
|
@ -34,6 +35,7 @@ func TestBrokenPromises(t *testing.T) {
|
||||||
|
|
||||||
gt.AddPromise(peerA, mids)
|
gt.AddPromise(peerA, mids)
|
||||||
gt.AddPromise(peerB, mids)
|
gt.AddPromise(peerB, mids)
|
||||||
|
gt.AddPromise(peerC, mids)
|
||||||
|
|
||||||
// no broken promises yet
|
// no broken promises yet
|
||||||
brokenPromises := gt.GetBrokenPromises()
|
brokenPromises := gt.GetBrokenPromises()
|
||||||
|
@ -41,6 +43,9 @@ func TestBrokenPromises(t *testing.T) {
|
||||||
t.Fatal("expected no broken promises")
|
t.Fatal("expected no broken promises")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// throttle one of the peers to save his promises
|
||||||
|
gt.ThrottlePeer(peerC)
|
||||||
|
|
||||||
// make promises break
|
// make promises break
|
||||||
time.Sleep(GossipSubIWantFollowupTime + 10*time.Millisecond)
|
time.Sleep(GossipSubIWantFollowupTime + 10*time.Millisecond)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue