Skip to content

Commit

Permalink
test: common: Fix MassiveParallelTest to not fail under slow emulation
Browse files Browse the repository at this point in the history
Thisi test occassionally failed on qemu emulating Alpine Linux
loongarch64.

Reduce the number of connect calls, and stop the server after shutting
down the threads repsonsible for accumulating requests.
  • Loading branch information
kohlschuetter committed Sep 11, 2024
1 parent 4ebb6bb commit d6cfd32
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import com.kohlschutter.annotations.compiletime.SuppressFBWarnings;
import com.kohlschutter.testutil.TestAbortedNotAnIssueException;
import com.kohlschutter.util.SystemPropertyUtil;

@AFSocketCapabilityRequirement(AFSocketCapability.CAPABILITY_UNIX_DOMAIN)
@SuppressWarnings({
Expand All @@ -72,9 +73,15 @@ public void testAcceptConnect() throws Exception {
}
// number of connections to perform
// final int numConnections = 1_000;
final int numConnections = 10_000;
// final int numConnections = 10_000;
// final int numConnections = 100_000;
// final int numConnections = 1_000_000;
final int numConnections = SystemPropertyUtil.getIntSystemProperty(
"selftest.MassiveParallelTest.numConnections", 1000);
if (numConnections <= 0) {
throw new TestAbortedNotAnIssueException("Skipping test due to numConnections="
+ numConnections);
}

// limit the number of concurrently active servers/clients
// so we don't run out of file descriptors (the limit could be as low as 256)
Expand Down Expand Up @@ -164,7 +171,6 @@ public void run() {
}

boolean stopped = server.cl.await(10, TimeUnit.SECONDS);
server.stop();
if (!stopped) {
List<Runnable> remainingClients = esClients.shutdownNow();
List<Runnable> remainingServers = server.esServers.shutdownNow();
Expand All @@ -174,6 +180,7 @@ public void run() {
+ remainingClients.size());
}
}
server.stop();

long elapsed = (System.currentTimeMillis() - startTime);
int completed = server.completed.intValue();
Expand Down

0 comments on commit d6cfd32

Please sign in to comment.