Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parallel test execution and mark long tests #588

Merged
merged 1 commit into from
Apr 19, 2024
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
10 changes: 2 additions & 8 deletions TrafficCapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,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 @@ -124,11 +123,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 @@ -208,6 +209,7 @@ public void onTrafficStreamIgnored(@NonNull IReplayContexts.ITrafficStreamsLifec
}

@Test
@Tag("longTest")
public void testCapturedReadsAfterCloseAreHandledAsNew() throws Exception {
var uri = new URI("http://localhost:9200");
try (var tr = new RootReplayerConstructorExtensions(rootContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,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 @@ -177,6 +178,7 @@ public void testHttpResponseIsSuccessfullyCaptured(boolean useTls, boolean large
"true, true"})
@Tag("longTest")
@WrapWithNettyLeakDetection(repetitions = 1)
@Tag("longTest")
public void testThatPeerResetTriggersFinalizeFuture(boolean useTls, boolean withServerReadTimeout) throws Exception {
final var RESPONSE_TIMEOUT_FOR_HUNG_TEST = Duration.ofMillis(500);
testPeerResets(useTls, withServerReadTimeout, RESPONSE_TIMEOUT_FOR_HUNG_TEST,
Expand Down Expand Up @@ -248,6 +250,7 @@ private void testPeerResets(boolean useTls, boolean withServerReadTimeout,
"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 @@ -297,6 +300,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 @@ -50,6 +51,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 @@ -166,6 +166,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.RootReplayerConstructorExtensions;
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