Skip to content

Commit

Permalink
SONARGO-70 Add "integration-test" to common Gradle modules
Browse files Browse the repository at this point in the history
  • Loading branch information
petertrr committed Dec 16, 2024
1 parent 9744396 commit 91a4c68
Show file tree
Hide file tree
Showing 88 changed files with 201 additions and 202 deletions.
8 changes: 4 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,19 @@ gradle_its_template: &GRADLE_ITS_TEMPLATE
run_its_script:
- git submodule update --init --depth 1
- source cirrus-env QA
- ./gradlew "${GRADLE_TASK}" "-P${ITS_PROJECT}"
- ./gradlew "${GRADLE_TASK}"
"-Dsonar.runtimeVersion=${SQ_VERSION}"
"-Dorchestrator.artifactory.accessToken=${ARTIFACTORY_ACCESS_TOKEN}"
"-DbuildNumber=$BUILD_NUMBER"
-I "${GRADLE_HOME}/init.d/repoxAuth.init.gradle.kts"
-Pqa --info --stacktrace --console plain --no-daemon --build-cache
--info --stacktrace --console plain --no-daemon --build-cache
<<: *CLEANUP_GRADLE_CACHE_SCRIPT

qa_plugin_task:

Check warning on line 123 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L123

task "qa_plugin" depends on task "build", but their only_if conditions are different

Check warning on line 123 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L123

task "qa_plugin" depends on task "build", but their only_if conditions are different

Check warning on line 123 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L123

task "qa_plugin" depends on task "build", but their only_if conditions are different

Check warning on line 123 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L123

task "qa_plugin" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
env:
ITS_PROJECT: "plugin"
GRADLE_TASK: ":its:plugin:test"
GRADLE_TASK: ":its:plugin:integrationTest"
matrix:
- SQ_VERSION: "DEV"
- SQ_VERSION: "LATEST_RELEASE"
Expand All @@ -137,7 +137,7 @@ qa_ruling_task:
<<: *QA_TASK_FILTER
env:
SQ_VERSION: "LATEST_RELEASE"
GRADLE_TASK: ":its:ruling:test"
GRADLE_TASK: ":its:ruling:integrationTest"
ITS_PROJECT: "ruling"
<<: *LINUX_4_CPU_8G
<<: *GRADLE_ITS_TEMPLATE
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
[submodule "build-logic"]
path = build-logic
url = https://github.com/SonarSource/cloud-native-gradle-modules
branch = SONARGO-70
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ git submodule update --init
Then build and run the Integration Tests using the `its` property:

```shell
./gradlew build -Pits --info --no-daemon
./gradlew integrationTest --info --no-daemon
```

You can also build and run only Ruling Tests using the `ruling` property:
You can also build and run only Ruling Tests:

```shell
./gradlew build -Pruling --info --no-daemon
./gradlew :its:ruling:integrationTest --info --no-daemon
```

## License headers
Expand Down
22 changes: 11 additions & 11 deletions its/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
id("org.sonarsource.cloud-native.integration-test")
}

dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.sonar.ws)
testImplementation(libs.assertj.core)
testImplementation(libs.sonarlint.core)
testImplementation(libs.sonar.orchestrator)
testRuntimeOnly(libs.junit.vintage.engine)
"integrationTestImplementation"(libs.sonar.analyzer.commons)
"integrationTestImplementation"(libs.sonar.ws)
"integrationTestImplementation"(libs.assertj.core)
"integrationTestImplementation"(libs.sonarlint.core)
"integrationTestImplementation"(libs.sonar.orchestrator)
"integrationTestRuntimeOnly"(libs.junit.vintage.engine)
}

sonarqube.isSkipProject = true

tasks.test {
onlyIf {
project.hasProperty("plugin") || project.hasProperty("its")
}
integrationTest {
testSources.set(file("projects"))
}
tasks.named<Test>("integrationTest") {
filter {
includeTestsMatching("org.sonarsource.slang.Tests")
includeTestsMatching("org.sonarsource.slang.SonarLintTest")
}
systemProperty("java.awt.headless", "true")
outputs.upToDateWhen { false }
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Tests {
ORCHESTRATOR = orchestratorBuilder
.useDefaultAdminCredentialsForBuilds(true)
.setSonarVersion(System.getProperty(SQ_VERSION_PROPERTY, DEFAULT_SQ_VERSION))
.restoreProfileAtStartup(FileLocation.of("src/test/resources/nosonar-go.xml"))
.restoreProfileAtStartup(FileLocation.of("src/integrationTest/resources/nosonar-go.xml"))
.build();
}

Expand Down
20 changes: 9 additions & 11 deletions its/ruling/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
id("org.sonarsource.cloud-native.integration-test")
}

dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.assertj.core)
testImplementation(libs.sonar.orchestrator)
testRuntimeOnly(libs.junit.vintage.engine)
"integrationTestImplementation"(libs.sonar.analyzer.commons)
"integrationTestImplementation"(libs.assertj.core)
"integrationTestImplementation"(libs.sonar.orchestrator)
"integrationTestRuntimeOnly"(libs.junit.vintage.engine)
}

sonarqube.isSkipProject = true

tasks.test {
onlyIf {
project.hasProperty("its") ||
project.hasProperty("ruling")
}

integrationTest {
testSources.set(rootProject.file("its/sources"))
}
tasks.named<Test>("integrationTest") {
systemProperty("java.awt.headless", "true")
outputs.upToDateWhen { false }
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void go_manual_keep_sonarqube_server_up() throws IOException {
@Test
public void test_go() throws IOException {
Map<String, String> properties = new HashMap<>();
properties.put("sonar.inclusions", "sources/**/*.go, ruling/src/test/resources/sources/**/*.go");
properties.put("sonar.inclusions", "sources/**/*.go, ruling/src/integrationTest/resources/sources/**/*.go");
properties.put("sonar.exclusions", "**/*generated*.go, **/*.pb.go");
properties.put("sonar.tests", ".");
properties.put("sonar.test.inclusions", "**/*_test.go");
Expand All @@ -123,7 +123,7 @@ private void run_ruling_test(Map<String, String> projectProperties) throws IOExc
.setSourceDirs("./")
.setSourceEncoding("utf-8")
.setProperties(properties)
.setProperty("sonar.lits.dump.old", Path.of("src/test/resources/expected").toAbsolutePath().toString())
.setProperty("sonar.lits.dump.old", Path.of("src/integrationTest/resources/expected").toAbsolutePath().toString())
.setProperty("sonar.lits.dump.new", actualDirectory.getAbsolutePath())
.setProperty("sonar.lits.differences", litsDifferencesFile.getAbsolutePath())
.setProperty("sonar.cpd.exclusions", "**/*")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/ParsingError.go':[
0,
],
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
'go-project:ruling/src/test/resources/sources/S103.go':[
'go-project:ruling/src/integrationTest/resources/sources/S103.go':[
7,
],
'go-project:ruling/src/test/resources/sources/S107.go':[
'go-project:ruling/src/integrationTest/resources/sources/S107.go':[
4,
],
'go-project:sources/kubernetes-client-go/applyconfigurations/admissionregistration/v1/matchresources.go':[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S107.go':[
'go-project:ruling/src/integrationTest/resources/sources/S107.go':[
4,
],
'go-project:sources/kubernetes-client-go/gentype/fake.go':[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
'go-project:ruling/src/test/resources/sources/S108.go':[
'go-project:ruling/src/integrationTest/resources/sources/S108.go':[
10,
18,
22,
],
'go-project:ruling/src/test/resources/sources/S1862.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1862.go':[
4,
6,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1110.go':[
4,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1125.go':[
4,
],
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S1135.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1135.go':[
6,
7,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
'go-project:ruling/src/test/resources/sources/S107.go':[
'go-project:ruling/src/integrationTest/resources/sources/S107.go':[
7,
10,
],
'go-project:ruling/src/test/resources/sources/S108.go':[
'go-project:ruling/src/integrationTest/resources/sources/S108.go':[
25,
],
'go-project:sources/kubernetes-client-go/rest/warnings.go':[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S1192.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1192.go':[
15,
],
'go-project:sources/kubernetes-client-go/dynamic/fake/simple.go':[
Expand Down
10 changes: 10 additions & 0 deletions its/ruling/src/integrationTest/resources/expected/go-S122.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1116.go':[
11,
],
'go-project:ruling/src/integrationTest/resources/sources/S122.go':[
8,
13,
17,
],
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S1862.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1862.go':[
6,
13,
20,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S108.go':[
'go-project:ruling/src/integrationTest/resources/sources/S108.go':[
18,
],
'go-project:sources/kubernetes-client-go/applyconfigurations/utils.go':[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1313.go':[
4,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1314.go':[
6,
],
}
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
'go-project:ruling/src/test/resources/sources/S103.go':[
'go-project:ruling/src/integrationTest/resources/sources/S103.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S105.go':[
'go-project:ruling/src/integrationTest/resources/sources/S105.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S107.go':[
'go-project:ruling/src/integrationTest/resources/sources/S107.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1110.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1110.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1116.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1116.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1125.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1125.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1135.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1135.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1192.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1192.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S122.go':[
'go-project:ruling/src/integrationTest/resources/sources/S122.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1313.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1313.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1656.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1656.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1763.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1763.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S1862.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1862.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S2068.go':[
'go-project:ruling/src/integrationTest/resources/sources/S2068.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S2757.go':[
'go-project:ruling/src/integrationTest/resources/sources/S2757.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S3923.go':[
'go-project:ruling/src/integrationTest/resources/sources/S3923.go':[
0,
],
'go-project:ruling/src/test/resources/sources/S4663.go':[
'go-project:ruling/src/integrationTest/resources/sources/S4663.go':[
0,
],
'go-project:sources/kubernetes-client-go/third_party/forked/golang/template/exec.go':[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1656.go':[
7,
9,
],
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S1763.go':[
'go-project:ruling/src/integrationTest/resources/sources/S1763.go':[
8,
19,
23,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S122.go':[
10,
],
}
10 changes: 10 additions & 0 deletions its/ruling/src/integrationTest/resources/expected/go-S1862.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S1862.go':[
6,
13,
20,
28,
30,
37,
],
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
'go-project:ruling/src/test/resources/sources/S2068.go':[
'go-project:ruling/src/integrationTest/resources/sources/S2068.go':[
4,
9,
10,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S2757.go':[
6,
7,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S3923.go':[
4,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'go-project:ruling/src/integrationTest/resources/sources/S4663.go':[
7,
],
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$!#@
$!#@
Loading

0 comments on commit 91a4c68

Please sign in to comment.