59 lines
1.8 KiB
Groovy
59 lines
1.8 KiB
Groovy
plugins {
|
|
id "com.github.johnrengelman.shadow" version "4.0.4"
|
|
id 'com.github.psxpaul.execfork' version '0.1.8'
|
|
}
|
|
apply from: "${rootDir}/gradle/java.gradle"
|
|
description = 'SpringBoot Smoke Tests.'
|
|
|
|
|
|
ext {
|
|
springbootHttpPort = 8080
|
|
}
|
|
|
|
// The standard spring-boot plugin doesn't play nice with our project
|
|
// so we'll build a fat jar instead
|
|
jar {
|
|
manifest {
|
|
attributes(
|
|
'Main-Class': 'datadog.smoketest.springboot.SpringbootApplication'
|
|
)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.18.RELEASE'
|
|
|
|
testCompile project(':dd-trace-api')
|
|
testCompile project(':dd-trace-ot')
|
|
testCompile project(':dd-java-agent:testing')
|
|
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
|
|
}
|
|
|
|
tasks.register("startServer", com.github.psxpaul.task.ExecFork) {
|
|
springbootHttpPort = randomOpenPort()
|
|
dependsOn project(':dd-java-agent').shadowJar, shadowJar
|
|
|
|
if (springbootHttpPort == -1) {
|
|
throw new GradleException("Failed to get random port to start springboot")
|
|
}
|
|
workingDir = "${buildDir}"
|
|
commandLine = "java"
|
|
args = ["-javaagent:${project(':dd-java-agent').tasks.shadowJar.archivePath}",
|
|
"-Ddd.writer.type=LoggingWriter",
|
|
"-Ddd.service.name=java-app",
|
|
"-Ddatadog.slf4j.simpleLogger.defaultLogLevel=debug",
|
|
"-jar",
|
|
"${tasks.shadowJar.archivePath}",
|
|
"--server.port=$springbootHttpPort"]
|
|
standardOutput "${buildDir}/reports/server.log"
|
|
waitForPort = springbootHttpPort
|
|
waitForOutput = "datadog.smoketest.springboot.SpringbootApplication - Started SpringbootApplication"
|
|
stopAfter = test
|
|
}
|
|
|
|
tasks.withType(Test).configureEach {
|
|
jvmArgs "-Ddatadog.smoketest.server.port=${springbootHttpPort}"
|
|
|
|
dependsOn startServer
|
|
}
|