Skip to content

Commit

Permalink
Remove parallel test execution and mark long tests
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <akurait@amazon.com>
  • Loading branch information
AndreKurait committed Apr 16, 2024
1 parent e5aafc6 commit 85c91cd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
10 changes: 2 additions & 8 deletions TrafficCapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ allprojects {
exclude project.property('excludeTests')
}
useJUnitPlatform {
systemProperty 'junit.jupiter.execution.parallel.enabled', 'true'
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', 'concurrent'
// Disable parallel test execution, see MIGRATIONS-1666
systemProperty 'junit.jupiter.execution.parallel.enabled', 'false'
}
}

Expand All @@ -122,11 +121,6 @@ allprojects {
}

task slowTest(type: Test) {
useJUnitPlatform {
// SlowTests currently use additional resource overhead, so halving core based parallelism
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'dynamic'
systemProperty 'junit.jupiter.execution.parallel.config.dynamic.factor', '0.5'
}
systemProperty 'disableMemoryLeakTests', 'false'
jacoco {
enabled = true
Expand Down
7 changes: 0 additions & 7 deletions TrafficCapture/trafficReplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,3 @@ jar {
attributes 'Main-Class': application.mainClass
}
}

// TODO: Fix Parallel Execution for junit trafficReplayer tests
// with resourceSharing of TrafficReplayerRunner to eliminate forking and rely on threads
slowTest {
forkEvery(1)
maxParallelForks = Runtime.runtime.availableProcessors()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.opensearch.migrations.replay.datatypes.ITrafficStreamKey;
import org.opensearch.migrations.replay.tracing.IReplayContexts;
Expand Down Expand Up @@ -206,6 +207,7 @@ public void onTrafficStreamIgnored(@NonNull IReplayContexts.ITrafficStreamsLifec
}

@Test
@Tag("longTest")
public void testCapturedReadsAfterCloseAreHandledAsNew() throws Exception {
try (var tr = new TrafficReplayerTopLevel(rootContext,
new URI("http://localhost:9200"), null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
Expand Down Expand Up @@ -143,6 +144,7 @@ private SimpleHttpResponse makeTestRequestViaClient(SimpleHttpClientForTesting c
"true, false",
"true, true"
})
@Tag("longTest")
public void testHttpResponseIsSuccessfullyCaptured(boolean useTls, boolean largeResponse) throws Exception {
try (var testServer = createTestServer(useTls, largeResponse)) {
for (int i = 0; i < 1; ++i) {
Expand Down Expand Up @@ -180,6 +182,7 @@ public void testHttpResponseIsSuccessfullyCaptured(boolean useTls, boolean large
"true, false",
"true, true"})
@WrapWithNettyLeakDetection(repetitions = 1)
@Tag("longTest")
public void testThatPeerResetTriggersFinalizeFuture(boolean useTls, boolean withServerReadTimeout) throws Exception {
try (var testServer = SimpleNettyHttpServer.makeServer(useTls,
withServerReadTimeout ? Duration.ofMillis(100) : null,
Expand Down Expand Up @@ -219,6 +222,7 @@ public void testThatPeerResetTriggersFinalizeFuture(boolean useTls, boolean with
"true, false",
"true, true"
})
@Tag("longTest")
public void testThatConnectionsAreKeptAliveAndShared(boolean useTls, boolean largeResponse)
throws Exception {
try (var testServer = SimpleNettyHttpServer.makeServer(useTls,
Expand Down Expand Up @@ -268,6 +272,7 @@ private static String getResponsePacketsAsString(AggregatedRawResponse response)
@ParameterizedTest
@ValueSource(booleans = {false, true})
@WrapWithNettyLeakDetection(repetitions = 1)
@Tag("longTest")
public void testMetricCountsFor_testThatConnectionsAreKeptAliveAndShared(boolean useTls) throws Exception {
testThatConnectionsAreKeptAliveAndShared(useTls, false);
Thread.sleep(200); // let metrics settle down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.opentelemetry.sdk.trace.data.SpanData;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -49,6 +50,7 @@ protected TestContext makeInstrumentationContext() {
@ParameterizedTest
@ValueSource(ints = {1, 2})
@ResourceLock("TrafficReplayerRunner")
@Tag("longTest")
public void testStreamWithRequestsWithCloseIsCommittedOnce(int numRequests) throws Throwable {
var random = new Random(1);
try (var httpServer = SimpleNettyHttpServer.makeServer(false, Duration.ofMinutes(10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void testLongRequestEndingAfterEOFStillCountsCorrectly() throws Throwable

@Test
@ResourceLock("TrafficReplayerRunner")
@Tag("longTest")
public void testSingleStreamWithCloseIsCommitted() throws Throwable {
var random = new Random(1);
try (var httpServer = SimpleNettyHttpServer.makeServer(false, Duration.ofMillis(2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.opentelemetry.sdk.metrics.data.MetricData;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.opensearch.migrations.replay.TimeShifter;
import org.opensearch.migrations.replay.TrafficReplayerTopLevel;
Expand Down Expand Up @@ -84,6 +85,7 @@ private static TrafficStream makeTrafficStreamFor(String connectionId, int conne
}

@Test
@Tag("longTest")
public void test() throws Exception {
TestContext rc = TestContext.withTracking(false, true);
var responseTracker = new TrackingResponseBuilder(3);
Expand Down

0 comments on commit 85c91cd

Please sign in to comment.