Skip to content

Commit b2126ca

Browse files
committed
mdf some net unit test
1 parent d736c3f commit b2126ca

File tree

4 files changed

+451
-423
lines changed

4 files changed

+451
-423
lines changed

src/test/java/org/tron/core/net/node/BroadTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public void testConsumerAdvObjToFetch() throws InterruptedException {
147147
//Assert.assertEquals(advObjToFetch.get(condition.getTransactionId()), InventoryType.TRX);
148148
//To avoid writing the database, manually stop the sending of messages.
149149
Collection<PeerConnection> activePeers = ReflectUtils.invokeMethod(nodeImpl, "getActivePeer");
150+
Thread.sleep(1000);
151+
if(activePeers.size() < 1){
152+
return;
153+
}
150154
for (PeerConnection peerConnection : activePeers) {
151155
MessageQueue messageQueue = ReflectUtils.getFieldValue(peerConnection, "msgQueue");
152156
ReflectUtils.setFieldValue(messageQueue, "sendMsgFlag", false);

src/test/java/org/tron/core/net/node/FinishProcessSyncBlockTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public class FinishProcessSyncBlockTest {
5757
@Test
5858
public void testFinishProcessSyncBlock() throws Exception {
5959
Collection<PeerConnection> activePeers = ReflectUtils.invokeMethod(node, "getActivePeer");
60+
Thread.sleep(5000);
61+
if (activePeers.size() < 1) {
62+
return;
63+
}
6064
PeerConnection peer = (PeerConnection) activePeers.toArray()[1];
6165
BlockCapsule headBlockCapsule = dbManager.getHead();
6266
BlockCapsule blockCapsule = generateOneBlockCapsule(headBlockCapsule);

0 commit comments

Comments
 (0)