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

SCAN4NET-178 Pin bundled plugin version to SQ9.9 ITs #2276

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,21 +360,21 @@ stages:
msbuild15_latest99:
PRODUCT: "SonarQube"
SQ_VERSION: "LATEST_RELEASE[9.9]"
SONAR_DOTNET_VERSION: '10.2.0.105762' # Last known working version with SQ 9.9
SONAR_DOTNET_VERSION: '8.51.0.59060' # Boundled version with SQ 9.9
SONAR_CFAMILYPLUGIN_VERSION: "6.41.0.60884" # LATEST_RELEASE of CFAMILY is not compatible with old SQ
MSBUILD_PATH: $(MSBUILD_15_PATH)
TEST_INCLUDE: "**/sonarqube/*"
msbuild16_latest99:
PRODUCT: "SonarQube"
SQ_VERSION: "LATEST_RELEASE[9.9]"
SONAR_DOTNET_VERSION: '10.2.0.105762' # Last known working version with SQ 9.9
SONAR_DOTNET_VERSION: '8.51.0.59060' # Boundled version with SQ 9.9
SONAR_CFAMILYPLUGIN_VERSION: "6.41.0.60884" # LATEST_RELEASE of CFAMILY is not compatible with old SQ
MSBUILD_PATH: $(MSBUILD_16_PATH)
TEST_INCLUDE: "**/sonarqube/*"
msbuild17_latest99:
PRODUCT: "SonarQube"
SQ_VERSION: "LATEST_RELEASE[9.9]"
SONAR_DOTNET_VERSION: '10.2.0.105762' # Last known working version with SQ 9.9
SONAR_DOTNET_VERSION: '8.51.0.59060' # Boundled version with SQ 9.9
SONAR_CFAMILYPLUGIN_VERSION: "6.41.0.60884" # LATEST_RELEASE of CFAMILY is not compatible with old SQ
MSBUILD_PATH: $(MSBUILD_17_PATH)
TEST_INCLUDE: "**/sonarqube/*"
Expand Down
1 change: 1 addition & 0 deletions its/projects/CSharp.Framework.4.8/Main/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public class Common
{
// FIXME: This line contains S1134 warning
public int Add(int a, int b) => a + b;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this is to avoid raising S2094 which is not available yet for the analyzer v.8.51.0.59060 so it would complicate the assertions on testCSharpFramework48

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import static com.sonar.it.scanner.msbuild.sonarqube.Tests.ORCHESTRATOR;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

@ExtendWith(Tests.class)
class SQLServerTest {
Expand Down Expand Up @@ -61,7 +62,11 @@ void should_find_issues_in_cs_files() throws Exception {
TestUtils.executeEndStepAndDumpResults(ORCHESTRATOR, projectDir, PROJECT_KEY, token);

List<Issue> issues = TestUtils.allIssues(ORCHESTRATOR);
assertThat(issues).hasSize(4);
if (ORCHESTRATOR.getServer().version().isGreaterThan(9, 9)) {
assertThat(issues).hasSize(4);
} else {
assertThat(issues).hasSize(3);
}
assertThat(TestUtils.getMeasureAsInteger(getFileKey(), "ncloc", ORCHESTRATOR)).isEqualTo(19);
assertThat(TestUtils.getMeasureAsInteger(PROJECT_KEY, "ncloc", ORCHESTRATOR)).isEqualTo(36);
assertThat(TestUtils.getMeasureAsInteger(getFileKey(), "lines", ORCHESTRATOR)).isEqualTo(23);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,18 +767,16 @@ void testCSharpFramework48() throws IOException {
assertUIWarnings(buildResult);
List<Issue> issues = TestUtils.allIssues(ORCHESTRATOR);
if (isTestProjectSupported()) {
assertThat(issues).hasSize(3)
assertThat(issues).hasSize(2)
.extracting(Issue::getRule, Issue::getComponent)
.containsExactlyInAnyOrder(
tuple(SONAR_RULES_PREFIX + "S1134", folderName + ":Main/Common.cs"),
tuple(SONAR_RULES_PREFIX + "S2094", folderName + ":Main/Common.cs"),
tuple(SONAR_RULES_PREFIX + "S2699", folderName + ":UTs/CommonTest.cs"));
} else {
assertThat(issues).hasSize(2)
assertThat(issues).hasSize(1)
.extracting(Issue::getRule, Issue::getComponent)
.containsExactlyInAnyOrder(
tuple(SONAR_RULES_PREFIX + "S1134", folderName + ":Main/Common.cs"),
tuple(SONAR_RULES_PREFIX + "S2094", folderName + ":Main/Common.cs"));
tuple(SONAR_RULES_PREFIX + "S1134", folderName + ":Main/Common.cs"));
}
}

Expand Down Expand Up @@ -1184,6 +1182,7 @@ void checkMultiLanguageSupportAngular() throws Exception {

@Test
void checkMultiLanguageSupportWithNonSdkFormat() throws Exception {
assumeTrue(ORCHESTRATOR.getServer().version().isGreaterThan(9, 9)); // Multi-language unsupported in SQ99
BuildResult result = runBeginBuildAndEndForStandardProject("MultiLanguageSupportNonSdk", "");
assertTrue(result.isSuccess());

Expand Down Expand Up @@ -1212,7 +1211,11 @@ void checkSourcesTestsIgnored() throws Exception {
var result = TestUtils.executeEndStepAndDumpResults(ORCHESTRATOR, projectDir, projectName, token);

assertTrue(result.isSuccess());
assertThat(TestUtils.allIssues(ORCHESTRATOR)).hasSize(4);
if (ORCHESTRATOR.getServer().version().isGreaterThan(9, 9)) {
assertThat(TestUtils.allIssues(ORCHESTRATOR)).hasSize(4);
} else {
assertThat(TestUtils.allIssues(ORCHESTRATOR)).hasSize(3);
}
}

private void waitForCacheInitialization(String projectKey, String baseBranch) {
Expand Down
Loading