Skip to content

Commit bffb835

Browse files
committed
Reduce HTTP test runtime with bounded method concurrency
1 parent 386658d commit bffb835

5 files changed

Lines changed: 92 additions & 0 deletions

File tree

‎SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/servercomm/http/HttpBackendSendLifecycleTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
import java.util.concurrent.TimeUnit;
2121
import java.util.concurrent.atomic.AtomicBoolean;
2222
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.api.parallel.Execution;
24+
import org.junit.jupiter.api.parallel.ExecutionMode;
2325
import org.junit.jupiter.api.io.TempDir;
2426

2527
class HttpBackendSendLifecycleTest {
2628
@TempDir Path directory;
2729

2830
@Test
31+
@Execution(ExecutionMode.CONCURRENT)
2932
void pausedSendCannotEnterAfterCloseAndFlushCutsOffNewSends() throws Exception {
3033
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
3134
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("authority"));
@@ -59,6 +62,7 @@ void pausedSendCannotEnterAfterCloseAndFlushCutsOffNewSends() throws Exception {
5962
}
6063

6164
@Test
65+
@Execution(ExecutionMode.CONCURRENT)
6266
void restartedConnectorRequiresAResponseFromItsNewRun() throws Exception {
6367
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("restart-proxy"), "localhost");
6468
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("restart-authority"));
@@ -82,6 +86,7 @@ void restartedConnectorRequiresAResponseFromItsNewRun() throws Exception {
8286
}
8387

8488
@Test
89+
@Execution(ExecutionMode.CONCURRENT)
8590
void startOpensSendAdmissionBeforeThePollerCanRun() throws Exception {
8691
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("startup-proxy"), "localhost");
8792
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("startup-authority"));
@@ -111,6 +116,7 @@ void startOpensSendAdmissionBeforeThePollerCanRun() throws Exception {
111116
}
112117

113118
@Test
119+
@Execution(ExecutionMode.CONCURRENT)
114120
void restartWaitsForThePreviousPollerToExit() throws Exception {
115121
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("restart-proxy"), "localhost");
116122
HttpConnectionCode code = new HttpConnectionCode("lobby-1", java.net.URI.create("https://localhost:8443/"),

‎SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/servercomm/http/HttpEnvelopeWireCodecTest.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525
import java.util.concurrent.atomic.AtomicInteger;
2626
import java.util.concurrent.atomic.AtomicReference;
2727
import org.junit.jupiter.api.Test;
28+
import org.junit.jupiter.api.parallel.Execution;
29+
import org.junit.jupiter.api.parallel.ExecutionMode;
2830
import org.junit.jupiter.api.io.TempDir;
2931

3032
class HttpEnvelopeWireCodecTest {
3133
@TempDir Path directory;
3234

3335
@Test
36+
@Execution(ExecutionMode.CONCURRENT)
3437
void serializedWrappersCoordinateConcurrentAccessToOneCodec() throws Exception {
3538
CountDownLatch firstEntered = new CountDownLatch(1);
3639
CountDownLatch releaseFirst = new CountDownLatch(1);
@@ -84,6 +87,7 @@ private JsonEnvelope apply(JsonEnvelope envelope) {
8487
}
8588

8689
@Test
90+
@Execution(ExecutionMode.CONCURRENT)
8791
void durableProxyQueueKeepsSemanticEnvelopeAcrossCodecChange() throws Exception {
8892
Path outgoing = directory.resolve("outgoing");
8993
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
@@ -116,6 +120,7 @@ void durableProxyQueueKeepsSemanticEnvelopeAcrossCodecChange() throws Exception
116120
}
117121

118122
@Test
123+
@Execution(ExecutionMode.CONCURRENT)
119124
void codecAppliesAtBothAuthenticatedHttpWireBoundaries() throws Exception {
120125
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("integration-proxy"), "localhost");
121126
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("integration-authority"));
@@ -147,6 +152,7 @@ void codecAppliesAtBothAuthenticatedHttpWireBoundaries() throws Exception {
147152
}
148153

149154
@Test
155+
@Execution(ExecutionMode.CONCURRENT)
150156
void wireExpansionIsRejectedBeforeItCanBlockAQueue() throws Exception {
151157
Path outgoing = directory.resolve("bounded-outgoing");
152158
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("bounded-proxy"), "localhost");
@@ -190,6 +196,7 @@ void wireExpansionIsRejectedBeforeItCanBlockAQueue() throws Exception {
190196
}
191197

192198
@Test
199+
@Execution(ExecutionMode.CONCURRENT)
193200
void uncheckedCodecRejectionReturnsFalseAtBothSendBoundaries() throws Exception {
194201
HttpEnvelopeWireCodec rejecting = new HttpEnvelopeWireCodec() {
195202
@Override public JsonEnvelope encode(JsonEnvelope envelope) {

‎SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/servercomm/http/HttpProxyLifecycleRecoveryTest.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
2929
import java.util.concurrent.atomic.AtomicBoolean;
3030
import java.util.concurrent.atomic.AtomicReference;
3131
import org.junit.jupiter.api.Test;
32+
import org.junit.jupiter.api.parallel.Execution;
33+
import org.junit.jupiter.api.parallel.ExecutionMode;
3234
import org.junit.jupiter.api.io.TempDir;
3335

3436
class HttpProxyLifecycleRecoveryTest {
3537
@TempDir Path directory;
3638

3739
@Test
40+
@Execution(ExecutionMode.CONCURRENT)
3841
void closeDefersOutgoingSealUntilAcknowledgeCallbackReturns() throws Exception {
3942
Path outgoing = directory.resolve("delayed-ack-outgoing");
4043
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("delayed-ack-proxy"), "localhost");
@@ -80,6 +83,7 @@ private static ThreadPoolExecutor listenerExecutor(HttpProxyTransportServer serv
8083
}
8184

8285
@Test
86+
@Execution(ExecutionMode.CONCURRENT)
8387
void callbackOwnedCloseCompletesItsInboundJournalBeforeItIsSealed() throws Exception {
8488
Path outgoing = directory.resolve("outgoing");
8589
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
@@ -121,6 +125,7 @@ void callbackOwnedCloseCompletesItsInboundJournalBeforeItIsSealed() throws Excep
121125
}
122126

123127
@Test
128+
@Execution(ExecutionMode.CONCURRENT)
124129
void failedNewBackendSetupCleansItsEmptyDirectoryBeforeRetry() throws Exception {
125130
Path root = directory.resolve("outgoing");
126131
AtomicBoolean failFirstBackendPublication = new AtomicBoolean(true);
@@ -142,6 +147,7 @@ void failedNewBackendSetupCleansItsEmptyDirectoryBeforeRetry() throws Exception
142147
}
143148

144149
@Test
150+
@Execution(ExecutionMode.CONCURRENT)
145151
void restartPrunesAccumulatedEmptyBackendDirectoriesBeforeApplyingTheCap() throws Exception {
146152
Path root = directory.resolve("outgoing");
147153
HttpTestAccess.DurableOutgoingQueue initial = new HttpTestAccess.DurableOutgoingQueue(root,
@@ -161,6 +167,7 @@ void restartPrunesAccumulatedEmptyBackendDirectoriesBeforeApplyingTheCap() throw
161167
}
162168

163169
@Test
170+
@Execution(ExecutionMode.CONCURRENT)
164171
void capPruningPreservesAnEmptyDirectoryUntilItsUnconfirmedAckCanRetry() throws Exception {
165172
Path root = directory.resolve("outgoing");
166173
Path lobbyDirectory = root.resolve("lobby-1");

0 commit comments

Comments
 (0)