From 385283c054d1a6e8ce7b3fe4a2ee366f8cf954c8 Mon Sep 17 00:00:00 2001 From: Julian Psotta Date: Fri, 22 Nov 2024 23:51:51 +0100 Subject: [PATCH] ci(tests): Speed up the verify tests with parallel execution --- .github/workflows/run_maven_tests.yml | 8 +++++++- .../ors/api/responses/matrix/MatrixResponseInfoTest.java | 3 +++ .../ors/fastisochrones/partitioning/InertialFlowTest.java | 3 +++ .../extensions/manage/remote/HttpRepoManagerTest.java | 3 +++ .../reader/borders/CountryBordersReaderTest.java | 3 +++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_maven_tests.yml b/.github/workflows/run_maven_tests.yml index b92348b506..e099d3bd1a 100644 --- a/.github/workflows/run_maven_tests.yml +++ b/.github/workflows/run_maven_tests.yml @@ -40,7 +40,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify -Papitests -Dors.engine.init-threads=5 jacoco:report -DCI=true org.sonarsource.scanner.maven:sonar-maven-plugin:sonar + run: | + mvn -B verify -Papitests \ + -Djunit.jupiter.execution.parallel.enabled=true \ + -Djunit.jupiter.execution.parallel.mode.default=concurrent \ + -Djunit.jupiter.execution.parallel.config.strategy=fixed \ + -Djunit.jupiter.execution.parallel.config.fixed.parallelism=4 \ + jacoco:report -DCI=true org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - name: Rocket.Chat Notification uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@1.1.1 env: diff --git a/ors-api/src/test/java/org/heigit/ors/api/responses/matrix/MatrixResponseInfoTest.java b/ors-api/src/test/java/org/heigit/ors/api/responses/matrix/MatrixResponseInfoTest.java index b803bf0e78..d1d244bd2b 100644 --- a/ors-api/src/test/java/org/heigit/ors/api/responses/matrix/MatrixResponseInfoTest.java +++ b/ors-api/src/test/java/org/heigit/ors/api/responses/matrix/MatrixResponseInfoTest.java @@ -6,6 +6,7 @@ import org.heigit.ors.matrix.MatrixResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; @@ -13,9 +14,11 @@ import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; @SpringBootTest @ActiveProfiles("unittest") +@Execution(SAME_THREAD) class MatrixResponseInfoTest { private static MatrixRequest bareMatrixRequest; private MatrixResponseInfo responseInformation; diff --git a/ors-engine/src/test/java/org/heigit/ors/fastisochrones/partitioning/InertialFlowTest.java b/ors-engine/src/test/java/org/heigit/ors/fastisochrones/partitioning/InertialFlowTest.java index 3ecf6b65b9..aeca3f5dc8 100644 --- a/ors-engine/src/test/java/org/heigit/ors/fastisochrones/partitioning/InertialFlowTest.java +++ b/ors-engine/src/test/java/org/heigit/ors/fastisochrones/partitioning/InertialFlowTest.java @@ -5,12 +5,15 @@ import com.graphhopper.storage.GraphHopperStorage; import org.heigit.ors.util.ToyGraphCreationUtil; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; import java.util.concurrent.ExecutorService; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +@Execution(SAME_THREAD) class InertialFlowTest { private final CarFlagEncoder carEncoder = new CarFlagEncoder(); private final EncodingManager encodingManager = EncodingManager.create(carEncoder); diff --git a/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/manage/remote/HttpRepoManagerTest.java b/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/manage/remote/HttpRepoManagerTest.java index 548e21ded9..6cf2f033e3 100644 --- a/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/manage/remote/HttpRepoManagerTest.java +++ b/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/manage/remote/HttpRepoManagerTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.api.parallel.Execution; import org.testcontainers.containers.NginxContainer; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; import org.testcontainers.junit.jupiter.Container; @@ -28,9 +29,11 @@ import static org.apache.commons.io.FileUtils.readFileToString; import static org.heigit.ors.routing.graphhopper.extensions.manage.RepoManagerTestHelper.*; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; @Testcontainers @ExtendWith(TestcontainersExtension.class) +@Execution(SAME_THREAD) class HttpRepoManagerTest { private static final String LOCAL_PROFILE_NAME = "driving-car"; diff --git a/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/reader/borders/CountryBordersReaderTest.java b/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/reader/borders/CountryBordersReaderTest.java index d9d183ce12..8f4585369a 100644 --- a/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/reader/borders/CountryBordersReaderTest.java +++ b/ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/reader/borders/CountryBordersReaderTest.java @@ -16,11 +16,14 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.GeometryFactory; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +@Execution(SAME_THREAD) class CountryBordersReaderTest { CountryBordersReader _oldReaderSingleton; CountryBordersReader _reader;