Skip to content

Commit 538c939

Browse files
committed
SONARPY-2431: Enable parallel test execution (#2233)
1 parent 3839043 commit 538c939

File tree

4 files changed

+19
-200
lines changed

4 files changed

+19
-200
lines changed

.cirrus.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ ruling_task:
167167
<<: *ONLY_SONARSOURCE_QA
168168
eks_container:
169169
<<: *QA_CONTAINER_DEFINITION
170-
cpu: 4
171-
memory: 8G
170+
cpu: 16
171+
memory: 32G
172172
env:
173173
CIRRUS_CLONE_DEPTH: 10
174174
SONARSOURCE_QA: true
@@ -181,7 +181,7 @@ ruling_task:
181181
- source cirrus-env QA
182182
- source set_maven_build_version $BUILD_NUMBER
183183
- cd its/ruling
184-
- mvn verify -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dtest=PythonRulingTest
184+
- mvn verify -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dtest=PythonRulingTest -Djunit.jupiter.execution.parallel.config.dynamic.factor=1
185185
cleanup_before_cache_script: cleanup_maven_repository
186186

187187
pr_analysis_qa_task:

its/ruling/src/test/java/org/sonar/python/it/PythonExtendedRulingTest.java

Lines changed: 0 additions & 196 deletions
This file was deleted.

its/ruling/src/test/java/org/sonar/python/it/PythonRulingTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
package org.sonar.python.it;
1818

1919
import com.sonar.orchestrator.build.SonarScanner;
20+
import com.sonar.orchestrator.version.Version;
21+
import com.sonar.orchestrator.build.SonarScannerInstaller;
22+
import com.sonar.orchestrator.config.Configuration;
2023
import com.sonar.orchestrator.junit5.OrchestratorExtension;
2124
import com.sonar.orchestrator.locator.FileLocation;
2225
import java.io.File;
@@ -26,17 +29,21 @@
2629
import org.junit.jupiter.api.BeforeAll;
2730
import org.junit.jupiter.api.Test;
2831
import org.junit.jupiter.api.extension.RegisterExtension;
32+
import org.junit.jupiter.api.parallel.Execution;
33+
import org.junit.jupiter.api.parallel.ExecutionMode;
2934
import org.sonarsource.analyzer.commons.ProfileGenerator;
3035

3136
import static java.nio.charset.StandardCharsets.UTF_8;
3237
import static org.assertj.core.api.Assertions.assertThat;
3338
import static org.sonar.python.it.RulingHelper.getOrchestrator;
3439

35-
// Ruling test for bug rules, to ensure they are properly tested without slowing down the CI
40+
@Execution(ExecutionMode.CONCURRENT)
3641
class PythonRulingTest {
3742

43+
3844
@RegisterExtension
3945
public static final OrchestratorExtension ORCHESTRATOR = getOrchestrator();
46+
public static final Configuration CONFIGURATION = ORCHESTRATOR.getConfiguration();
4047

4148
private static final String PROFILE_NAME = "rules";
4249

@@ -52,6 +59,11 @@ static void prepare_quality_profile() {
5259
ORCHESTRATOR.getServer().restoreProfile(FileLocation.of(iPythonProfileFile));
5360
}
5461

62+
@BeforeAll
63+
static void install_sonar_scanner() {
64+
new SonarScannerInstaller(CONFIGURATION.locators()).install(Version.create(SonarScanner.DEFAULT_SCANNER_VERSION), CONFIGURATION.fileSystem().workspace());
65+
}
66+
5567
@Test
5668
void test_airflow() throws IOException {
5769
SonarScanner build = buildWithCommonProperties("airflow");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
junit.jupiter.execution.parallel.enabled = true
2+
junit.jupiter.execution.parallel.config.strategy=dynamic
3+
junit.jupiter.execution.parallel.config.dynamic.factor=0.5

0 commit comments

Comments
 (0)