Skip to content

fix(testcase): remove peer from PeerManager after testcase#6486

Merged
kuny0707 merged 3 commits intotronprotocol:release_v4.8.1from
317787106:hotfix/remove_peer_after_testcase
Nov 27, 2025
Merged

fix(testcase): remove peer from PeerManager after testcase#6486
kuny0707 merged 3 commits intotronprotocol:release_v4.8.1from
317787106:hotfix/remove_peer_after_testcase

Conversation

@317787106
Copy link

@317787106 317787106 commented Nov 25, 2025

What does this PR do?

  • remove peer from PeerManager after testcase, fix RpcApiServicesTest.testGetNodeInfo
  • add log when receives keep alive message in BackupManager to help for debug
  • check if tronNetDelegate is 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());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add Args.clearParam(); ?

Copy link
Author

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?

Copy link
Author

@317787106 317787106 Nov 27, 2025

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

@kuny0707 kuny0707 merged commit 0779184 into tronprotocol:release_v4.8.1 Nov 27, 2025
7 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants