fix(testcase): remove peer from PeerManager after testcase by 317787106 · Pull Request #6486 · tronprotocol/java-tron
Conversation
What does this PR do?
- remove peer from PeerManager after testcase, fix RpcApiServicesTest.testGetNodeInfo
- add log when receives keep alive message in
BackupManagerto help for debug - check if
tronNetDelegateis null in PeerStatusCheck to fix NullPointerException when use mock in several testcases, such as org.tron.core.net.peer.PeerStatusCheckMockTest. NullPointerException occurs only in mock test.
Why are these changes required?
This PR has been tested by:
- Unit Tests
- Manual Testing
Follow up
Extra details
| public void clearPeers() { | ||
| for (PeerConnection p : PeerManager.getPeers()) { | ||
| PeerManager.remove(p.getChannel()); | ||
| } |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add Args.clearParam(); ?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This testcase has extended BaseTest which implements Args.clearParam() in @afterclass method.
| return; | ||
| } | ||
|
|
||
| logger.info("Receive keep alive message from {}", sender); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be sender.getHostString() to keep consistency with lines 121 and 126?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it's more accurate to logging InetSocketAddress, the style is /IP:port. Line 126 only needs IP
warku123 pushed a commit to warku123/java-tron that referenced this pull request
Feb 6, 2026…col#6486) * remove peer from PeerManager after testcase * add coverage of NodeInfoServiceTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters