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

@ -78,7 +78,7 @@ tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
waitForOutput = "Listening for HTTP on /127.0.0.1:${playHttpPort}"
timeout = 240
environment = [
'JAVA_OPTS' : "-javaagent:${project(':dd-java-agent').tasks.shadowJar.archivePath}"
'JAVA_OPTS': "-javaagent:${project(':dd-java-agent').tasks.shadowJar.archivePath}"
+ " -Ddd.writer.type=LoggingWriter" + " -Ddd.service.name=java-app"
+ " -Ddatadog.slf4j.simpleLogger.defaultLogLevel=debug"
+ " -Dorg.slf4j.simpleLogger.defaultLogLevel=debug"
@ -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

@ -98,7 +98,7 @@ jar {
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Implementation-Vendor": "Datadog",
"Implementation-URL" :"https://github.com/datadog/dd-trace-java",
"Implementation-URL": "https://github.com/datadog/dd-trace-java",
)
}
}
@ -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 }
}
tasks.withType(Test).configureEach {
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
plugins.withType(BasePlugin) {