go-libp2p
go-libp2p copied to clipboard
chore(connmgr): clean TestMultiplePeers
In the context of looking into https://github.com/libp2p/go-libp2p/issues/1324, clean up TestMultiplePeers.
Leaving as a draft for now as I'm missing the target for id[2] of 40. It doesn't match the expected value of adding the bumps and subtracting the decays as it does for the other two peers. The decay is the same for each peer 330 (120, 150, 60 from the 3 tags combined), but the peers start with different initial bump values:
- ID0: 3000 - 330 = 2670
- ID1: 1500 - 330 = 1170
- ID2: 300 - 330 = -30. This is what's showing up on the test now but in the original code it was 40, not sure what's the rationale.
@raulk Was that the math you had in mind when you were writing the tests or am I missing something?
Seems I'm not correctly interpreting the logic of the negative case in this more linearized version of the test:
https://github.com/libp2p/go-libp2p/blob/66cd76df22e8f50717da0cfd1765f90d4d58f1e0/p2p/net/connmgr/decay.go#L191-L202
@raulk Would it be ok to keep this test with positive values (to simplify testing logic) and move the negative case to a separate test (with more elaborate logic accounting for the code above)?
Closing due to inactivity.