Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.api.io.TempDir;

class HttpBackendSendLifecycleTest {
@TempDir Path directory;

@Test
@Execution(ExecutionMode.CONCURRENT)
void pausedSendCannotEnterAfterCloseAndFlushCutsOffNewSends() throws Exception {
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("authority"));
Expand Down Expand Up @@ -59,6 +62,7 @@ void pausedSendCannotEnterAfterCloseAndFlushCutsOffNewSends() throws Exception {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void restartedConnectorRequiresAResponseFromItsNewRun() throws Exception {
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("restart-proxy"), "localhost");
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("restart-authority"));
Expand All @@ -82,6 +86,7 @@ void restartedConnectorRequiresAResponseFromItsNewRun() throws Exception {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void startOpensSendAdmissionBeforeThePollerCanRun() throws Exception {
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("startup-proxy"), "localhost");
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("startup-authority"));
Expand Down Expand Up @@ -111,6 +116,7 @@ void startOpensSendAdmissionBeforeThePollerCanRun() throws Exception {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void restartWaitsForThePreviousPollerToExit() throws Exception {
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("restart-proxy"), "localhost");
HttpConnectionCode code = new HttpConnectionCode("lobby-1", java.net.URI.create("https://localhost:8443/"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.api.io.TempDir;

class HttpEnvelopeWireCodecTest {
@TempDir Path directory;

@Test
@Execution(ExecutionMode.CONCURRENT)
void serializedWrappersCoordinateConcurrentAccessToOneCodec() throws Exception {
CountDownLatch firstEntered = new CountDownLatch(1);
CountDownLatch releaseFirst = new CountDownLatch(1);
Expand Down Expand Up @@ -84,6 +87,7 @@ private JsonEnvelope apply(JsonEnvelope envelope) {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void durableProxyQueueKeepsSemanticEnvelopeAcrossCodecChange() throws Exception {
Path outgoing = directory.resolve("outgoing");
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
Expand Down Expand Up @@ -116,6 +120,7 @@ void durableProxyQueueKeepsSemanticEnvelopeAcrossCodecChange() throws Exception
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void codecAppliesAtBothAuthenticatedHttpWireBoundaries() throws Exception {
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("integration-proxy"), "localhost");
HttpEnrollmentAuthority authority = new HttpEnrollmentAuthority(identity, directory.resolve("integration-authority"));
Expand Down Expand Up @@ -147,6 +152,7 @@ void codecAppliesAtBothAuthenticatedHttpWireBoundaries() throws Exception {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void wireExpansionIsRejectedBeforeItCanBlockAQueue() throws Exception {
Path outgoing = directory.resolve("bounded-outgoing");
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("bounded-proxy"), "localhost");
Expand Down Expand Up @@ -190,6 +196,7 @@ void wireExpansionIsRejectedBeforeItCanBlockAQueue() throws Exception {
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void uncheckedCodecRejectionReturnsFalseAtBothSendBoundaries() throws Exception {
HttpEnvelopeWireCodec rejecting = new HttpEnvelopeWireCodec() {
@Override public JsonEnvelope encode(JsonEnvelope envelope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.api.io.TempDir;

class HttpProxyLifecycleRecoveryTest {
@TempDir Path directory;

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

@Test
@Execution(ExecutionMode.CONCURRENT)
void callbackOwnedCloseCompletesItsInboundJournalBeforeItIsSealed() throws Exception {
Path outgoing = directory.resolve("outgoing");
HttpTlsIdentity identity = HttpTlsIdentity.loadOrCreate(directory.resolve("proxy"), "localhost");
Expand Down Expand Up @@ -121,6 +125,7 @@ void callbackOwnedCloseCompletesItsInboundJournalBeforeItIsSealed() throws Excep
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void failedNewBackendSetupCleansItsEmptyDirectoryBeforeRetry() throws Exception {
Path root = directory.resolve("outgoing");
AtomicBoolean failFirstBackendPublication = new AtomicBoolean(true);
Expand All @@ -142,6 +147,7 @@ void failedNewBackendSetupCleansItsEmptyDirectoryBeforeRetry() throws Exception
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void restartPrunesAccumulatedEmptyBackendDirectoriesBeforeApplyingTheCap() throws Exception {
Path root = directory.resolve("outgoing");
HttpTestAccess.DurableOutgoingQueue initial = new HttpTestAccess.DurableOutgoingQueue(root,
Expand All @@ -161,6 +167,7 @@ void restartPrunesAccumulatedEmptyBackendDirectoriesBeforeApplyingTheCap() throw
}

@Test
@Execution(ExecutionMode.CONCURRENT)
void capPruningPreservesAnEmptyDirectoryUntilItsUnconfirmedAckCanRetry() throws Exception {
Path root = directory.resolve("outgoing");
Path lobbyDirectory = root.resolve("lobby-1");
Expand Down
Loading
Loading