mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-03 12:16:27 -04:00
Wait for peer nodes bootstrap in network stress test
Once it threw a ``ConcurrentModificationException`` while shutting down but I've not been able to reproduce it, so keep an eye on it happening again.
This commit is contained in:
parent
fe9b3ec5f6
commit
1910b66aef
1 changed files with 7 additions and 1 deletions
|
@ -55,6 +55,8 @@ public class NetworkStressTest {
|
||||||
|
|
||||||
/** A barrier to wait for concurrent reception of preliminary data in peers. */
|
/** A barrier to wait for concurrent reception of preliminary data in peers. */
|
||||||
private CountDownLatch prelimDataLatch = new CountDownLatch(NPEERS);
|
private CountDownLatch prelimDataLatch = new CountDownLatch(NPEERS);
|
||||||
|
/** A barrier to wait for concurrent bootstrap of peers. */
|
||||||
|
private CountDownLatch bootstrapLatch = new CountDownLatch(NPEERS);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -146,7 +148,8 @@ public class NetworkStressTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBootstrapComplete() {
|
public void onBootstrapComplete() {
|
||||||
// do nothing
|
// successful result
|
||||||
|
NetworkStressTest.this.bootstrapLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -195,6 +198,9 @@ public class NetworkStressTest {
|
||||||
// Wait for peers to get their preliminary data.
|
// Wait for peers to get their preliminary data.
|
||||||
org.junit.Assert.assertTrue("timed out while waiting for preliminary data",
|
org.junit.Assert.assertTrue("timed out while waiting for preliminary data",
|
||||||
prelimDataLatch.await(30, TimeUnit.SECONDS));
|
prelimDataLatch.await(30, TimeUnit.SECONDS));
|
||||||
|
// Wait for peers to complete their bootstrapping.
|
||||||
|
org.junit.Assert.assertTrue("timed out while waiting for bootstrap",
|
||||||
|
bootstrapLatch.await(30, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path createTempDirectory() throws IOException {
|
private Path createTempDirectory() throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue