mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-22 06:38:55 -04:00
Print network stress test steps to help locating the source of warnings
This commit is contained in:
parent
8eefecdc9c
commit
a9efa4ec15
1 changed files with 9 additions and 0 deletions
|
@ -116,6 +116,7 @@ public class NetworkStressTest {
|
||||||
|
|
||||||
// Create the test data directory.
|
// Create the test data directory.
|
||||||
testDataDir = createTestDataDirectory();
|
testDataDir = createTestDataDirectory();
|
||||||
|
print("test data directory: " + testDataDir);
|
||||||
|
|
||||||
// Create and start the seed node.
|
// Create and start the seed node.
|
||||||
seedNode = new SeedNode(testDataDir.toString());
|
seedNode = new SeedNode(testDataDir.toString());
|
||||||
|
@ -126,6 +127,7 @@ public class NetworkStressTest {
|
||||||
seedNode.createAndStartP2PService(seedNodeAddress, useLocalhost,
|
seedNode.createAndStartP2PService(seedNodeAddress, useLocalhost,
|
||||||
REGTEST_NETWORK_ID, USE_DETAILED_LOGGING, seedNodes,
|
REGTEST_NETWORK_ID, USE_DETAILED_LOGGING, seedNodes,
|
||||||
new SeedServiceListener(localServicesLatch, localServicesFailed));
|
new SeedServiceListener(localServicesLatch, localServicesFailed));
|
||||||
|
print("created seed node");
|
||||||
|
|
||||||
// Create and start peer nodes.
|
// Create and start peer nodes.
|
||||||
SeedNodesRepository seedNodesRepository = new SeedNodesRepository();
|
SeedNodesRepository seedNodesRepository = new SeedNodesRepository();
|
||||||
|
@ -151,6 +153,7 @@ public class NetworkStressTest {
|
||||||
peerNodes.add(peer);
|
peerNodes.add(peer);
|
||||||
peer.start(new PeerServiceListener(localServicesLatch, localServicesFailed));
|
peer.start(new PeerServiceListener(localServicesLatch, localServicesFailed));
|
||||||
}
|
}
|
||||||
|
print("created peer nodes");
|
||||||
|
|
||||||
// Wait for concurrent tasks to finish.
|
// Wait for concurrent tasks to finish.
|
||||||
localServicesLatch.await();
|
localServicesLatch.await();
|
||||||
|
@ -159,6 +162,8 @@ public class NetworkStressTest {
|
||||||
if (localServicesFailed.get()) {
|
if (localServicesFailed.get()) {
|
||||||
throw new Exception("nodes failed to start");
|
throw new Exception("nodes failed to start");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print("all local nodes started");
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -187,6 +192,7 @@ public class NetworkStressTest {
|
||||||
}
|
}
|
||||||
// Wait for concurrent tasks to finish.
|
// Wait for concurrent tasks to finish.
|
||||||
shutdownLatch.await();
|
shutdownLatch.await();
|
||||||
|
print("all local nodes stopped");
|
||||||
|
|
||||||
// Cleanup test data directory.
|
// Cleanup test data directory.
|
||||||
if (testDataDir != null) {
|
if (testDataDir != null) {
|
||||||
|
@ -199,9 +205,11 @@ public class NetworkStressTest {
|
||||||
// Wait for peers to get their preliminary data.
|
// Wait for peers to get their preliminary data.
|
||||||
assertLatch("timed out while waiting for preliminary data",
|
assertLatch("timed out while waiting for preliminary data",
|
||||||
prelimDataLatch, 30, TimeUnit.SECONDS);
|
prelimDataLatch, 30, TimeUnit.SECONDS);
|
||||||
|
print("preliminary data received");
|
||||||
// Wait for peers to complete their bootstrapping.
|
// Wait for peers to complete their bootstrapping.
|
||||||
assertLatch("timed out while waiting for bootstrap",
|
assertLatch("timed out while waiting for bootstrap",
|
||||||
bootstrapLatch, 30, TimeUnit.SECONDS);
|
bootstrapLatch, 30, TimeUnit.SECONDS);
|
||||||
|
print("bootstrap complete");
|
||||||
|
|
||||||
// Test each peer sending a direct message to another random peer.
|
// Test each peer sending a direct message to another random peer.
|
||||||
final int nPeers = peerNodes.size();
|
final int nPeers = peerNodes.size();
|
||||||
|
@ -247,6 +255,7 @@ public class NetworkStressTest {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print("%d direct messages scheduled to be sent by each of %d peers", directCount, nPeers);
|
||||||
// Since receiving is completed before sending is reported to be complete,
|
// Since receiving is completed before sending is reported to be complete,
|
||||||
// all receiving checks should end before all sending checks to avoid deadlocking.
|
// all receiving checks should end before all sending checks to avoid deadlocking.
|
||||||
/** Time to transmit all messages in the worst random case, and with no computation delays. */
|
/** Time to transmit all messages in the worst random case, and with no computation delays. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue