Simply since the agent code doesn't run without java.instrument
This commit is contained in:
parent
7a0ba452b8
commit
fa378e16d3
|
@ -1,21 +0,0 @@
|
||||||
ext {
|
|
||||||
minJavaVersionForTests = JavaVersion.VERSION_1_9
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "${rootDir}/gradle/java.gradle"
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes(
|
|
||||||
'Main-Class': 'datadog.smoketest.moduleapp.instrumentable.ModuleApplication'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jlink {
|
|
||||||
moduleName = 'datadog.smoketest.moduleapp.instrumentable'
|
|
||||||
options = ['--no-man-pages', '--no-header-files']
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = "1.9"
|
|
||||||
targetCompatibility = "1.9"
|
|
|
@ -1,11 +0,0 @@
|
||||||
package datadog.smoketest.moduleapp.instrumentable;
|
|
||||||
|
|
||||||
public class ModuleApplication {
|
|
||||||
public static void main(final String[] args) {
|
|
||||||
final String agentStatus = System.getProperty("dd.agent.status");
|
|
||||||
|
|
||||||
if (!"INSTALLED".equals(agentStatus)) {
|
|
||||||
throw new RuntimeException("Incorrect agent status: " + agentStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
module datadog.smoketest.moduleapp.instrumentable {
|
|
||||||
exports datadog.smoketest.moduleapp.instrumentable;
|
|
||||||
}
|
|
|
@ -2,21 +2,34 @@ plugins {
|
||||||
id 'org.beryx.jlink' version '2.1.1' // latest version that doesn't have a Java 11+ warning
|
id 'org.beryx.jlink' version '2.1.1' // latest version that doesn't have a Java 11+ warning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
minJavaVersionForTests = JavaVersion.VERSION_1_9
|
||||||
|
}
|
||||||
|
|
||||||
apply from: "${rootDir}/gradle/java.gradle"
|
apply from: "${rootDir}/gradle/java.gradle"
|
||||||
|
|
||||||
sourceCompatibility = "1.9"
|
sourceCompatibility = "1.9"
|
||||||
targetCompatibility = "1.9"
|
targetCompatibility = "1.9"
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes(
|
||||||
|
'Main-Class': 'datadog.smoketest.moduleapp.ModuleApplication'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jlink {
|
||||||
|
moduleName = 'datadog.smoketest.moduleapp'
|
||||||
|
options = ['--no-man-pages', '--no-header-files', '--add-modules', 'java.instrument']
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
dependsOn tasks.jlink
|
||||||
|
jvmArgs "-Ddatadog.smoketest.module.image=${jlink.imageDir.get()}"
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile project(':dd-smoke-tests')
|
testCompile project(':dd-smoke-tests')
|
||||||
}
|
}
|
||||||
|
|
||||||
Project main_project = project
|
|
||||||
subprojects { subProject ->
|
|
||||||
apply plugin: "org.beryx.jlink"
|
|
||||||
|
|
||||||
main_project.tasks.test.dependsOn subProject.tasks.jlink
|
|
||||||
|
|
||||||
main_project.tasks.test.jvmArgs "-Ddatadog.smoketest.${subProject.tasks.jlink.moduleName.get()}.image=${subProject.tasks.jlink.imageDir.get()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package datadog.smoketest.moduleapp;
|
||||||
|
|
||||||
|
public class ModuleApplication {
|
||||||
|
public static void main(final String[] args) throws InterruptedException {
|
||||||
|
Thread.sleep(600);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module datadog.smoketest.moduleapp {
|
||||||
|
exports datadog.smoketest.moduleapp;
|
||||||
|
}
|
|
@ -4,27 +4,25 @@ import spock.lang.Timeout
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
abstract class Java9ModulesSmokeTest extends AbstractSmokeTest {
|
class Java9ModulesSmokeTest extends AbstractSmokeTest {
|
||||||
// Estimate for the amount of time instrumentation plus some extra
|
// Estimate for the amount of time instrumentation plus some extra
|
||||||
private static final int TIMEOUT_SECS = 30
|
private static final int TIMEOUT_SECS = 30
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ProcessBuilder createProcessBuilder() {
|
ProcessBuilder createProcessBuilder() {
|
||||||
println System.getProperties()
|
println System.getProperties()
|
||||||
String imageDir = System.getProperty("datadog.smoketest.${moduleName}.image")
|
String imageDir = System.getProperty("datadog.smoketest.module.image")
|
||||||
|
|
||||||
assert imageDir != null
|
assert imageDir != null
|
||||||
|
|
||||||
List<String> command = new ArrayList<>()
|
List<String> command = new ArrayList<>()
|
||||||
command.add(imageDir + "/bin/java")
|
command.add(imageDir + "/bin/java")
|
||||||
command.addAll(defaultJavaProperties)
|
command.addAll(defaultJavaProperties)
|
||||||
command.addAll((String[]) ["-m", "${moduleName}/${moduleName}.ModuleApplication"])
|
command.addAll((String[]) ["-m", "datadog.smoketest.moduleapp/datadog.smoketest.moduleapp.ModuleApplication"])
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(command)
|
ProcessBuilder processBuilder = new ProcessBuilder(command)
|
||||||
processBuilder.directory(new File(buildDirectory))
|
processBuilder.directory(new File(buildDirectory))
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getModuleName()
|
|
||||||
|
|
||||||
// TODO: once java7 support is dropped use waitFor() with timeout call added in java8
|
// TODO: once java7 support is dropped use waitFor() with timeout call added in java8
|
||||||
// instead of timeout on test
|
// instead of timeout on test
|
||||||
@Timeout(value = TIMEOUT_SECS, unit = TimeUnit.SECONDS)
|
@Timeout(value = TIMEOUT_SECS, unit = TimeUnit.SECONDS)
|
||||||
|
@ -33,19 +31,3 @@ abstract class Java9ModulesSmokeTest extends AbstractSmokeTest {
|
||||||
assert serverProcess.waitFor() == 0
|
assert serverProcess.waitFor() == 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InstrumentableModuleTest extends Java9ModulesSmokeTest {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
def getModuleName() {
|
|
||||||
return "datadog.smoketest.moduleapp.instrumentable"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UninstrumentableModuleTest extends Java9ModulesSmokeTest {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
def getModuleName() {
|
|
||||||
return "datadog.smoketest.moduleapp.uninstrumentable"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package datadog.smoketest.moduleapp.uninstrumentable;
|
|
||||||
|
|
||||||
public class ModuleApplication {
|
|
||||||
public static void main(final String[] args) {
|
|
||||||
final String agentStatus = System.getProperty("dd.agent.status");
|
|
||||||
|
|
||||||
if (!"NOT_INSTALLED".equals(agentStatus)) {
|
|
||||||
throw new RuntimeException("Incorrect agent status: " + agentStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
module datadog.smoketest.moduleapp.uninstrumentable {
|
|
||||||
exports datadog.smoketest.moduleapp.uninstrumentable;
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
ext {
|
|
||||||
minJavaVersionForTests = JavaVersion.VERSION_1_9
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "${rootDir}/gradle/java.gradle"
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes(
|
|
||||||
'Main-Class': 'datadog.smoketest.moduleapp.uninstrumentable.ModuleApplication'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jlink {
|
|
||||||
moduleName = 'datadog.smoketest.moduleapp.uninstrumentable'
|
|
||||||
options = ['--no-man-pages', '--no-header-files']
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = "1.9"
|
|
||||||
targetCompatibility = "1.9"
|
|
|
@ -24,8 +24,6 @@ include ':dd-smoke-tests:springboot'
|
||||||
include ':dd-smoke-tests:wildfly'
|
include ':dd-smoke-tests:wildfly'
|
||||||
include ':dd-smoke-tests:cli'
|
include ':dd-smoke-tests:cli'
|
||||||
include ':dd-smoke-tests:java9-modules'
|
include ':dd-smoke-tests:java9-modules'
|
||||||
include ':dd-smoke-tests:java9-modules:instrumentable-module-app'
|
|
||||||
include ':dd-smoke-tests:java9-modules:uninstrumentable-module-app'
|
|
||||||
|
|
||||||
// instrumentation:
|
// instrumentation:
|
||||||
include ':dd-java-agent:instrumentation:akka-http-10.0'
|
include ':dd-java-agent:instrumentation:akka-http-10.0'
|
||||||
|
|
Loading…
Reference in New Issue