-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor checkMaxConnections #3126
Refactor checkMaxConnections #3126
Conversation
this might be a good opportunity to add a unit test for PeerManager (possibly limited to the scope of connection handling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
It seems the PeerManagerTest is ignored and in need of an overhaul. |
Could someone of the exisiting contributors try out this branch before merging, as it would cause big problems if some use-case handling is wrong. I just read through the code and it looks fine, but it would be good to give this a local test as well. |
I think that code part is really a good candidate for a test. The logic is a bit involved and bigger changes here are tough to test manually. I would postpone otherwise merge until someone had dedicated enough time to be sure all is correct. |
Agreed. I will try to look into implementing some tests. Just not familiar with this area so will need some time to ramp up. |
@devinbileck Are you still on this PR? |
I started looking into it but didn't make much progress. I haven't focused on it very much lately. If someone else is able to contribute something, feel free. Otherwise I will try to get to it. |
Fix connection limit checks so as to prevent the following warning: > WARN b.n.p2p.peers.PeerManager: No candidates found to remove (That case should not be possible as we use in the last case all connections).
@devinbileck Could you please resolve the conflict and add some tests? |
I have added some tests. I will be committing them shortly. |
18e4190
to
500a90a
Compare
The old PeerManagerTest was located under network/p2p/routing, which is no longer the correct location. Additionally, it was outdated so I just removed it and added a new file under network/p2p/peers containing tests for checkMaxConnections.
500a90a
to
b45765f
Compare
This is necessary because bisq.network.p2p.MockNode imports bisq.core.network.p2p.seed.DefaultSeedNodeRepository.
@freimair As I haven't touched this part of the codebase so far, could you please do the review? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we could get away with mocking the SeedNodeRepository
superclass, thus eliminating the dependency to core
. Can you verify that this is correct?
Mock the SeedNodeRepository superclass, thus eliminating the dependency to core.
Yes, good point. Updated! |
Fix connection limit checks so as to prevent the following warning: