mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-01 19:26:09 -04:00
Split network stress tests in direct and mailbox
Now they can be run independently.
This commit is contained in:
parent
c67f724e0f
commit
4b75235f33
1 changed files with 9 additions and 5 deletions
|
@ -226,9 +226,9 @@ public class NetworkStressTest {
|
|||
}
|
||||
}
|
||||
|
||||
/** Test each peer sending a direct message to another random peer. */
|
||||
@Test
|
||||
public void test() throws InterruptedException {
|
||||
// Test each peer sending a direct message to another random peer.
|
||||
public void test_direct() throws InterruptedException {
|
||||
final int nPeers = peerNodes.size();
|
||||
BooleanProperty sentDirectFailed = new SimpleBooleanProperty(false);
|
||||
final List<Long> sentDelays = new Vector<>(nPeers * directCount);
|
||||
|
@ -298,8 +298,11 @@ public class NetworkStressTest {
|
|||
directCount, (System.currentTimeMillis() - sendStartMillis) / 1000.0,
|
||||
mma.first, mma.second, mma.third);
|
||||
org.junit.Assert.assertFalse("some peer(s) failed to send a direct message", sentDirectFailed.get());
|
||||
}
|
||||
|
||||
// Test sending and receiving mailbox messages.
|
||||
/** Test sending and receiving mailbox messages. */
|
||||
@Test
|
||||
public void test_mailbox() throws InterruptedException {
|
||||
// We start by putting the first half of peers online and the second one offline.
|
||||
// Then the first online peer sends a number of messages to random peers (regardless of their state),
|
||||
// so that some messages are delivered directly and others into a mailbox.
|
||||
|
@ -353,6 +356,7 @@ public class NetworkStressTest {
|
|||
});
|
||||
bootLatch.await();
|
||||
|
||||
final int nPeers = peerNodes.size();
|
||||
for (int firstOnline = 0, firstOffline = (int)Math.ceil(nPeers/2.0);
|
||||
firstOnline < nPeers;
|
||||
firstOnline++, firstOffline = ++firstOffline%nPeers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue