Add smoketest README and move random port to common util
ADD
dd-smoke-tests/README.md
+# Datadog Smoke Tests
+Assert that various application servers will start up with the Datadog JavaAgent without any obvious ill effects.
+
+Each subproject underneath `dd-smoke-tests` is a single smoke test. Each test does the following
+* Launch the app server with stdout and stderr logged to `$buildDir/reports/server.log`
+* Run a spock test which does 200 requests to an endpoint on the server and asserts on an expected response.
+
+Note that there is nothing special about doing 200 requests. 200 is simply an arbitrarily large number to exercise the server.

MODIFY
dd-smoke-tests/play/play.gradle
dd-smoke-tests/play/play.gradle
@@ -69,20 +69,6 @@ dependencies {
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
}
-/** Open up a random, reusable port. */
-def randomOpenPort() {
- final ServerSocket socket
- try {
- socket = new ServerSocket(0)
- socket.setReuseAddress(true)
- socket.close()
- return socket.getLocalPort()
- } catch (final IOException ioe) {
- ioe.printStackTrace()
- return -1
- }
-}
-
task startServer(type: com.github.psxpaul.task.ExecFork) {
dependsOn project(':dd-java-agent').shadowJar
playHttpPort = randomOpenPort()

MODIFY
dd-smoke-tests/springboot/springboot.gradle
dd-smoke-tests/springboot/springboot.gradle
@@ -20,22 +20,6 @@ jar {
}
}
-
-// TODO: move to common util
-/** Open up a random, reusable port. */
-def randomOpenPort() {
- final ServerSocket socket
- try {
- socket = new ServerSocket(0)
- socket.setReuseAddress(true)
- socket.close()
- return socket.getLocalPort()
- } catch (final IOException ioe) {
- ioe.printStackTrace()
- return -1
- }
-}
-
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.18.RELEASE'

MODIFY
dd-smoke-tests/wildfly/wildfly.gradle
dd-smoke-tests/wildfly/wildfly.gradle
@@ -36,20 +36,6 @@ dependencies {
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
}
-/** Open up a random, reusable port. */
-def randomOpenPort() {
- final ServerSocket socket
- try {
- socket = new ServerSocket(0)
- socket.setReuseAddress(true)
- socket.close()
- return socket.getLocalPort()
- } catch (final IOException ioe) {
- ioe.printStackTrace()
- return -1
- }
-}
-
task unzip(type: Copy) {
def zipFileNamePrefix = "servlet"
def zipPath = project.configurations.compile.find {

MODIFY
dd-trace-java.gradle
dd-trace-java.gradle
@@ -22,6 +22,7 @@ allprojects {
}
apply from: "${rootDir}/gradle/dependencies.gradle"
+ apply from: "${rootDir}/gradle/util.gradle"
}
repositories {

MODIFY
gradle/util.gradle
gradle/util.gradle
@@ -11,3 +11,17 @@ task artifacts {
}
}
}
+
+/** Find a random, reusable port. */
+ext.randomOpenPort = { ->
+ final ServerSocket socket
+ try {
+ socket = new ServerSocket(0)
+ socket.setReuseAddress(true)
+ socket.close()
+ return socket.getLocalPort()
+ } catch (final IOException ioe) {
+ ioe.printStackTrace()
+ return -1
+ }
+}

Add smoketest README and move random port to common util