Skip to content

Commit

Permalink
Fix Java ITs
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-marichal committed Aug 12, 2024
1 parent 32d4351 commit f25cd16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions its/src/test/java/com/sonar/it/csharp/AnalysisWarningsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,26 @@ void analysisWarningsImport() throws IOException {

Ce.Task task = TestUtils.getAnalysisWarningsTask(ORCHESTRATOR, buildResult);
assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(task.getWarningsList()).containsExactly("First message", "Second message");
assertThat(task.getWarningsList()).containsExactly("First message", "Second message", "Multi-Language analysis is enabled. If this was not intended, please set \"/d:sonar.scanner.scanAll=false\" in the begin step.");
}

@Test
void analysisWarnings_MSBuild14() throws IOException {
BuildResult buildResult = Tests.analyzeProject(temp, "Roslyn.1.3.2");
Ce.Task task = TestUtils.getAnalysisWarningsTask(ORCHESTRATOR, buildResult);
assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(task.getWarningsList()).containsExactly("The analysis using MsBuild 14 is no longer supported and the analysis with MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.");
assertThat(task.getWarningsList()).containsExactly(
"The analysis using MsBuild 14 is no longer supported and the analysis with MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.",
"Multi-Language analysis is enabled. If this was not intended, please set \"/d:sonar.scanner.scanAll=false\" in the begin step.");
}

@Test
void analysisWarnings_MSBuild15() throws IOException {
BuildResult buildResult = Tests.analyzeProject(temp, "Roslyn.2.4.0");
Ce.Task task = TestUtils.getAnalysisWarningsTask(ORCHESTRATOR, buildResult);
assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(task.getWarningsList()).containsExactly("The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.");
assertThat(task.getWarningsList()).containsExactly(
"The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.",
"Multi-Language analysis is enabled. If this was not intended, please set \"/d:sonar.scanner.scanAll=false\" in the begin step.");
}
}
3 changes: 2 additions & 1 deletion its/src/test/java/com/sonar/it/shared/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public static void verifyGuiTestOnlyProjectAnalysisWarning(Orchestrator orchestr
+ " and no MAIN-code for any language, so only TEST-code related results are imported. "
+ "Many of our rules (e.g. vulnerabilities) are raised only on MAIN-code. "
+ "Read more about how the SonarScanner for .NET detects test projects: "
+ "https://github.com/SonarSource/sonar-scanner-msbuild/wiki/Analysis-of-product-projects-vs.-test-projects");
+ "https://github.com/SonarSource/sonar-scanner-msbuild/wiki/Analysis-of-product-projects-vs.-test-projects",
"Multi-Language analysis is enabled. If this was not intended, please set \"/d:sonar.scanner.scanAll=false\" in the begin step.");
}

public static Ce.Task getAnalysisWarningsTask(Orchestrator orchestrator, BuildResult buildResult) {
Expand Down

0 comments on commit f25cd16

Please sign in to comment.