Skip to content

Commit

Permalink
SLE-806: Only support SonarQube 9.9 and newer (#686)
Browse files Browse the repository at this point in the history
* SLE-806: Only support SQ 9.9 LTS and above

Remove integration test restrictions on old SonarQube versions.
Update pipeline to only include active SonarQube versions and the correct Orchestrator configuration.

* SLE-806: Fix flaky tests

We should be only checking for SonarLint-related markers.
  • Loading branch information
thahnen authored Jun 27, 2024
1 parent f3ab7b3 commit 3b0f598
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 42 deletions.
20 changes: 9 additions & 11 deletions .cirrus.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,20 @@ qa_task:
matrix:
- env:
TARGET_PLATFORM: 'oldest'
SQ_VERSION: 'LATEST_RELEASE[8.9]'
QA_CATEGORY: 'Oldest'
SQ_VERSION: 'LATEST_RELEASE[9.9]'
QA_CATEGORY: 'oldest-LATEST_RELEASE_99'
- env:
TARGET_PLATFORM: 'latest'
SQ_VERSION: 'LATEST_RELEASE[9.9]'
QA_CATEGORY: 'Latest-LTS'
QA_CATEGORY: 'latest-LATEST_RELEASE_99'
- env:
TARGET_PLATFORM: 'latest'
SQ_VERSION: 'LATEST_RELEASE'
QA_CATEGORY: 'latest-LATEST_RELEASE'
- env:
TARGET_PLATFORM: 'latest'
SQ_VERSION: 'DEV'
QA_CATEGORY: 'Latest'
QA_CATEGORY: 'latest-DEV'
<<: *SETUP_MAVEN_CACHE_QA
<<: *SETUP_ORCHESTRATOR_CACHE
download_staged_update_site_script: |
Expand All @@ -198,15 +202,9 @@ qa_task:
ffmpeg -loglevel warning -f x11grab -video_size 1920x1080 -i ${DISPLAY} -codec:v libx264 -r 12 ${CIRRUS_WORKING_DIR}/recording_${QA_CATEGORY}.mp4
run_its_script: |
echo "Run Maven ITs for Eclipse ${TARGET_PLATFORM} and Server ${SQ_VERSION}"
ORCHESTRATOR_CONFIG="-Dorchestrator.configUrl=file:///$CIRRUS_WORKING_DIR/its/orchestrator.properties"
if [[ "${TARGET_PLATFORM}" == "oldest" ]]; then
ORCHESTRATOR_CONFIG="-Dorchestrator.configUrl=file:///$CIRRUS_WORKING_DIR/its/orchestrator-oldest.properties"
fi
mvn -B -e -V org.jacoco:jacoco-maven-plugin:prepare-agent verify -f its/pom.xml -Pcoverage \
-Dtarget.platform=${TARGET_PLATFORM} -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://${CIRRUS_WORKING_DIR}/staged-repository" -Dsonar.runtimeVersion=${SQ_VERSION} \
-Djacoco.append=true -Djacoco.destFile=${CIRRUS_WORKING_DIR}/it-coverage.exec $ORCHESTRATOR_CONFIG
-Djacoco.append=true -Djacoco.destFile=${CIRRUS_WORKING_DIR}/it-coverage.exec
mv it-coverage.exec it-coverage-${QA_CATEGORY}.exec
cleanup_before_cache_script: cleanup_maven_repository
always:
Expand Down
3 changes: 1 addition & 2 deletions .cirrus.ibuilds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ qa_ibuilds_task:
mvn -B -e -V verify -f its/pom.xml \
-Dtarget.platform=ibuilds -Dtycho.localArtifacts=ignore \
-Dsonarlint-eclipse.p2.url="file://${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.site/target/repository" \
-Dsonar.runtimeVersion="LATEST_RELEASE[9.9]" \
-Dorchestrator.configUrl=file:///$CIRRUS_WORKING_DIR/its/orchestrator.properties
-Dsonar.runtimeVersion="LATEST_RELEASE[9.9]"
cleanup_before_cache_script: cleanup_maven_repository
always:
stop_recording_script: |
Expand Down
6 changes: 0 additions & 6 deletions its/orchestrator-oldest.properties

This file was deleted.

4 changes: 0 additions & 4 deletions its/orchestrator.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ protected static void createConnectionAndBindProject(OrchestratorRule orchestrat

connectionNamePage.setConnectionName("test");
wizard.next();

if (orchestrator.getServer().version().isGreaterThanOrEquals(8, 7)) {
// SONAR-14306 Starting from 8.7, dev notifications are available even in community edition
wizard.next();
}
wizard.next();
wizard.finish();

new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
Expand Down
20 changes: 9 additions & 11 deletions its/src/org/sonarlint/eclipse/its/SonarQubeConnectedModeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ public void shouldFindSecretsInConnectedMode() {

@Test
public void shouldAutomaticallyUpdateRuleSetWhenChangedOnServer() throws Exception {
Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals(9, 4));

new JavaPerspective().open();
var rootProject = importExistingProjectIntoWorkspace("java/java-simple", JAVA_SIMPLE_PROJECT_KEY);

Expand All @@ -261,8 +259,11 @@ public void shouldAutomaticallyUpdateRuleSetWhenChangedOnServer() throws Excepti
// INFO: This is a corner case where we cannot use AbstractSonarLintTest#waitForMarkers!
var defaultEditor = new TextEditor();
await().untilAsserted(() -> {
assertThat(defaultEditor.getMarkers()).hasSize(1);
assertThat(defaultEditor.getMarkers())
.filteredOn(marker -> marker.getType().equals("org.sonarlint.eclipse.onTheFlyIssueAnnotationType"))
.hasSize(1);
assertThat(defaultEditor.getMarkers())
.filteredOn(marker -> marker.getType().equals("org.sonarlint.eclipse.onTheFlyIssueAnnotationType"))
.satisfiesAnyOf(
list -> assertThat(list)
.extracting(Marker::getText, Marker::getLineNumber)
Expand All @@ -283,7 +284,9 @@ public void shouldAutomaticallyUpdateRuleSetWhenChangedOnServer() throws Excepti
defaultEditor.save();
});

assertThat(defaultEditor.getMarkers()).isEmpty();
assertThat(defaultEditor.getMarkers())
.filteredOn(marker -> marker.getType().equals("org.sonarlint.eclipse.onTheFlyIssueAnnotationType"))
.isEmpty();
});
}

Expand Down Expand Up @@ -531,7 +534,7 @@ private static QualityProfile getQualityProfile(String projectKey, String qualit
private static void deactivateRule(QualityProfile qualityProfile, String ruleKey) {
var request = new PostRequest("/api/qualityprofiles/deactivate_rule")
.setParam("key", qualityProfile.getKey())
.setParam("rule", javaRuleKey(ruleKey));
.setParam("rule", "java:" + ruleKey);
try (var response = adminWsClient.wsConnector().call(request)) {
assertTrue("Unable to deactivate rule " + ruleKey, response.isSuccessful());
}
Expand All @@ -540,17 +543,12 @@ private static void deactivateRule(QualityProfile qualityProfile, String ruleKey
private static void activateRule(QualityProfile qualityProfile, String ruleKey) {
var request = new PostRequest("/api/qualityprofiles/activate_rule")
.setParam("key", qualityProfile.getKey())
.setParam("rule", javaRuleKey(ruleKey));
.setParam("rule", "java:" + ruleKey);
try (var response = adminWsClient.wsConnector().call(request)) {
assertTrue("Unable to activate rule " + ruleKey, response.isSuccessful());
}
}

private static String javaRuleKey(String key) {
// Starting from SonarJava 6.0 (embedded in SQ 8.2), rule repository has been changed
return orchestrator.getServer().version().isGreaterThanOrEquals(8, 2) ? ("java:" + key) : ("squid:" + key);
}

private static void setNewCodePeriodToPreviousVersion(String projectKey) {
orchestrator.getServer()
.newHttpCall("api/new_code_periods/set")
Expand Down
4 changes: 2 additions & 2 deletions its/src/org/sonarlint/eclipse/its/StandaloneAnalysisTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ public void shouldAnalyseJava() {
helloJavaFile.open();

var textEditor = new TextEditor();
assertThat(textEditor.getMarkers()).isEmpty();
waitForNoMarkers(textEditor);

textEditor.insertText(8, 29, "2");
textEditor.save();

assertThat(textEditor.getMarkers()).isEmpty();
waitForNoMarkers(textEditor);

assertThat(scheduledAnalysisJobCount.get()).isEqualTo(analysisJobCountBefore);

Expand Down
2 changes: 1 addition & 1 deletion its/target-platforms/oldest.target
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
<repository location="https://www.pydev.org/update_sites/6.0.0/" />
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" />
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17" />
</target>

0 comments on commit 3b0f598

Please sign in to comment.