Do not run smoke test servers when tests are disabled

Unfortunately Gradle seem to need some manual help to figure this one out.
This commit is contained in:
Nikolay Martynov 2019-05-16 12:44:20 -04:00
parent 4a8bea4602
commit 6b6668826d
4 changed files with 19 additions and 6 deletions

View File

@ -87,6 +87,9 @@ tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
]
dependsOn 'stage'
// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
tasks.register("deletePIDFile") {

View File

@ -50,6 +50,9 @@ tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
waitForOutput = "datadog.smoketest.springboot.SpringbootApplication - Started SpringbootApplication"
timeout = 240
stopAfter = test
// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
tasks.withType(Test).configureEach {

View File

@ -50,6 +50,9 @@ tasks.register("unzip", Copy) {
} else {
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
}
// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
@ -83,6 +86,9 @@ tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
]
dependsOn unzip
// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
tasks.register("stopWildfly", Exec) {
@ -92,6 +98,9 @@ tasks.register("stopWildfly", Exec) {
args = ["--connect", "--controller=localhost:${wildflyManagementPort}", "command=:shutdown"]
dependsOn startServer
// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
tasks.withType(Test).configureEach {

View File

@ -302,10 +302,8 @@ for (def env : System.getenv().entrySet()) {
}
// Disable all tests if skipTests property was specified
if (project.hasProperty("skipTests")) {
tasks.withType(Test).configureEach {
onlyIf { false }
}
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
plugins.withType(BasePlugin) {