Skip to content

Commit 7c8e2c9

Browse files
authored
Don't cache integrationTest tasks (#15)
1 parent 3888325 commit 7c8e2c9

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

gradle-modules/src/main/kotlin/org.sonarsource.cloud-native.integration-test.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,32 @@ val integrationTestConfiguration = extensions.create<IntegrationTestExtension>("
3434
configurations[integrationTest.implementationConfigurationName].extendsFrom(configurations.testImplementation.get())
3535
configurations[integrationTest.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get())
3636

37+
val sonarRuntimeVersion: String = System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")
3738
tasks.register<Test>("integrationTest") {
3839
description = "Runs integration tests."
3940
group = "verification"
4041
inputs.dir(integrationTestConfiguration.testSources)
41-
inputs.property("SQ version", System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE"))
42+
inputs.property("SQ version", sonarRuntimeVersion)
4243
inputs.property("keep SQ running", System.getProperty("keepSonarqubeRunning", "false"))
4344
useJUnitPlatform()
4445

4546
testClassesDirs = integrationTest.output.classesDirs
4647
classpath = configurations[integrationTest.runtimeClasspathConfigurationName] + integrationTest.output
4748

48-
if (System.getProperty("sonar.runtimeVersion") != null) {
49-
systemProperty("sonar.runtimeVersion", System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE"))
50-
}
49+
systemProperty("sonar.runtimeVersion", sonarRuntimeVersion)
5150

52-
if (System.getProperty("keepSonarqubeRunning") != null) {
53-
systemProperty("keepSonarqubeRunning", System.getProperty("keepSonarqubeRunning"))
51+
System.getProperty("keepSonarqubeRunning")?.let {
52+
systemProperty("keepSonarqubeRunning", it)
5453
}
5554

5655
testLogging {
5756
// log the full stack trace (default is the 1st line of the stack trace)
5857
exceptionFormat = TestExceptionFormat.FULL
5958
events(STARTED, PASSED, SKIPPED, FAILED)
6059
}
60+
61+
outputs.upToDateWhen {
62+
// As the exact SQ version is not known at configuration time, we cannot know if the task is up-to-date
63+
false
64+
}
6165
}

0 commit comments

Comments
 (0)