Skip to content

Commit 4d157c0

Browse files
committed
Add smoke test for quarkus native
1 parent 546f797 commit 4d157c0

14 files changed

Lines changed: 487 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ignore all project specific gradle directories/files
2+
.gradle
3+
gradle
4+
build
5+
gradlew
6+
gradlew.bat
7+
8+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
plugins {
2+
id 'java'
3+
id 'io.quarkus'
4+
id "com.diffplug.spotless" version "6.13.0"
5+
}
6+
7+
def sharedRootDir = "$rootDir/../../../"
8+
def sharedConfigDirectory = "$sharedRootDir/gradle"
9+
rootProject.ext.sharedConfigDirectory = sharedConfigDirectory
10+
11+
apply from: "$sharedConfigDirectory/repositories.gradle"
12+
apply from: "$sharedConfigDirectory/spotless.gradle"
13+
14+
if (hasProperty('appBuildDir')) {
15+
buildDir = property('appBuildDir')
16+
}
17+
18+
version = ""
19+
20+
dependencies {
21+
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
22+
implementation 'io.quarkus:quarkus-resteasy'
23+
if (hasProperty('apiJar')) {
24+
implementation files(property('apiJar'))
25+
} else {
26+
implementation "com.datadoghq:dd-trace-api:1.38.1"
27+
}
28+
}
29+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
quarkusPluginVersion=3.12.1
2+
quarkusPlatformArtifactId=quarkus-universe-bom
3+
quarkusPlatformGroupId=io.quarkus
4+
quarkusPlatformVersion=3.12.1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
pluginManagement {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
}
7+
plugins {
8+
id 'io.quarkus' version "${quarkusPluginVersion}"
9+
}
10+
}
11+
12+
def isCI = System.getenv("CI") != null
13+
14+
// Don't pollute the dependency cache with the build cache
15+
if (isCI) {
16+
def sharedRootDir = "$rootDir/../../../"
17+
buildCache {
18+
local {
19+
// This needs to line up with the code in the outer project settings.gradle
20+
directory = "$sharedRootDir/workspace/build-cache"
21+
}
22+
}
23+
}
24+
25+
rootProject.name='quarkus-native-smoketest'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package datadog.smoketest;
2+
3+
import datadog.trace.api.GlobalTracer;
4+
import datadog.trace.api.Tracer;
5+
import jakarta.ws.rs.DefaultValue;
6+
import jakarta.ws.rs.GET;
7+
import jakarta.ws.rs.Path;
8+
import jakarta.ws.rs.Produces;
9+
import jakarta.ws.rs.QueryParam;
10+
import jakarta.ws.rs.core.MediaType;
11+
import org.jboss.logging.Logger;
12+
13+
@Path("/hello-jboss")
14+
public class JBossLoggingResource {
15+
Logger log = Logger.getLogger(JBossLoggingResource.class);
16+
17+
@GET
18+
@Produces(MediaType.TEXT_PLAIN)
19+
public String hello(@DefaultValue("0") @QueryParam("id") int id) {
20+
Tracer tracer = GlobalTracer.get();
21+
log.debug("TT|" + tracer.getTraceId() + "|TS|" + tracer.getSpanId());
22+
return "Hello " + id + "!";
23+
}
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package datadog.smoketest;
2+
3+
import datadog.trace.api.GlobalTracer;
4+
import datadog.trace.api.Tracer;
5+
import jakarta.ws.rs.DefaultValue;
6+
import jakarta.ws.rs.GET;
7+
import jakarta.ws.rs.Path;
8+
import jakarta.ws.rs.Produces;
9+
import jakarta.ws.rs.QueryParam;
10+
import jakarta.ws.rs.core.MediaType;
11+
import org.slf4j.Logger;
12+
import org.slf4j.LoggerFactory;
13+
14+
@Path("/hello-slf4j")
15+
public class Slf4JResource {
16+
Logger log = LoggerFactory.getLogger(Slf4JResource.class);
17+
18+
@GET
19+
@Produces(MediaType.TEXT_PLAIN)
20+
public String hello(@DefaultValue("0") @QueryParam("id") int id) {
21+
Tracer tracer = GlobalTracer.get();
22+
log.debug("TT|" + tracer.getTraceId() + "|TS|" + tracer.getSpanId());
23+
return "Hello " + id + "!";
24+
}
25+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Nothing to see here!</title>
6+
</head>
7+
<body>
8+
<h1>Nothing to see here!</h1>
9+
</body>
10+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
quarkus.log.level=INFO
2+
quarkus.log.category."datadog.smoketest".level=DEBUG
3+
quarkus.log.console.format=%d %-5p [%c] '%t' |MT|%X{dd.trace_id}|MS|%X{dd.span_id}|%m%e%n
4+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
apply from: "$rootDir/gradle/java.gradle"
2+
3+
dependencies {
4+
testImplementation project(':dd-smoke-tests')
5+
}
6+
def testJvm = gradle.startParameter.projectProperties.getOrDefault('testJvm', '')
7+
// In order to support GraalVM 21 we need at least Java 17 for Gradle
8+
def java17Home = System.getenv('JAVA_17_HOME')
9+
// Check 'testJvm' gradle command parameter to be at least GraalVM 17
10+
def matcher = testJvm?.toLowerCase(Locale.ROOT) =~ /graalvm([0-9]+)/
11+
def version = matcher?.size() == 1 ? Integer.parseInt(matcher[0][1]) : -1
12+
if (version >= 17) {
13+
// Retrieve GRAALVM_HOME from JVM environment variables
14+
def testJvmEnv = "JAVA_${testJvm}_HOME"
15+
def testJvmHome = System.getenv(testJvmEnv)
16+
if (!testJvmHome) {
17+
throw new GradleException("Unable to find launcher for Java '$testJvm'. Have you set '$testJvmEnv'?")
18+
}
19+
def javaHome = version >= 21 ? java17Home : testJvmHome
20+
// Configure build directory for application
21+
def appDir = "$projectDir/application"
22+
def appBuildDir = "$buildDir/application"
23+
def isWindows = System.getProperty('os.name').toLowerCase().contains('win')
24+
def gradlewCommand = isWindows ? 'gradlew.bat' : 'gradlew'
25+
26+
// Define the task that builds the project
27+
tasks.register('quarkusNativeBuild', Exec) {
28+
workingDir "$appDir"
29+
environment += [
30+
'GRADLE_OPTS' : "-Dorg.gradle.jvmargs='-Xmx512M'",
31+
'JAVA_HOME' : javaHome,
32+
'GRAALVM_HOME': testJvmHome
33+
]
34+
commandLine(
35+
"$rootDir/${gradlewCommand}",
36+
'build',
37+
'--no-daemon',
38+
'--max-workers=4',
39+
"-Dquarkus.native.enabled=true",
40+
"-Dquarkus.package.jar.enabled=false",
41+
"-PappBuildDir=$appBuildDir",
42+
"-PapiJar=${project(':dd-trace-api').tasks.jar.archiveFile.get()}",
43+
"-Dquarkus.native.additional-build-args=-J-javaagent:${project(':dd-java-agent').tasks.shadowJar.archiveFile.get()}," +
44+
"-J-Ddatadog.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSS'Z [dd.trace]',-march=native"
45+
)
46+
outputs.cacheIf { true }
47+
outputs.dir(appBuildDir)
48+
.withPropertyName('nativeApplication')
49+
inputs.files(fileTree(appDir) {
50+
include '**/*'
51+
exclude '.gradle/**'
52+
}).withPropertyName('application')
53+
.withPathSensitivity(PathSensitivity.RELATIVE)
54+
inputs.file(project(':dd-trace-api').tasks.jar.archiveFile.get()).withPropertyName('apiJar')
55+
inputs.file(project(':dd-java-agent').tasks.shadowJar.archiveFile.get()).withPropertyName('agentJar')
56+
}
57+
58+
quarkusNativeBuild {
59+
dependsOn project(':dd-trace-api').tasks.named("jar") // Use dev @Trace annotation
60+
dependsOn project(':dd-java-agent').tasks.named('shadowJar') // Use dev agent
61+
}
62+
63+
tasks.named('compileTestGroovy').configure {
64+
dependsOn 'quarkusNativeBuild'
65+
outputs.upToDateWhen {
66+
!quarkusNativeBuild.didWork
67+
}
68+
}
69+
70+
tasks.withType(Test).configureEach {
71+
jvmArgs "-Ddatadog.smoketest.quarkus.native.executable=$appBuildDir/quarkus-native-smoketest--runner"
72+
}
73+
74+
} else {
75+
tasks.withType(Test).configureEach {
76+
enabled = false
77+
}
78+
}
79+
80+
spotless {
81+
java {
82+
target "**/*.java"
83+
}
84+
85+
groovyGradle {
86+
target '*.gradle', "**/*.gradle"
87+
}
88+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# This is a Gradle generated file for dependency locking.
2+
# Manual edits can break the build and are not advised.
3+
# This file is expected to be part of source control.
4+
cafe.cryptography:curve25519-elisabeth:0.1.0=testRuntimeClasspath
5+
cafe.cryptography:ed25519-elisabeth:0.1.0=testRuntimeClasspath
6+
ch.qos.logback:logback-classic:1.2.3=testCompileClasspath,testRuntimeClasspath
7+
ch.qos.logback:logback-core:1.2.3=testCompileClasspath,testRuntimeClasspath
8+
com.beust:jcommander:1.78=testRuntimeClasspath
9+
com.blogspot.mydailyjava:weak-lock-free:0.17=testCompileClasspath,testRuntimeClasspath
10+
com.datadoghq.okhttp3:okhttp:3.12.15=testCompileClasspath,testRuntimeClasspath
11+
com.datadoghq.okio:okio:1.17.6=testCompileClasspath,testRuntimeClasspath
12+
com.datadoghq:dd-javac-plugin-client:0.1.7=testCompileClasspath,testRuntimeClasspath
13+
com.datadoghq:java-dogstatsd-client:4.4.0=testRuntimeClasspath
14+
com.datadoghq:sketches-java:0.8.3=testRuntimeClasspath
15+
com.github.javaparser:javaparser-core:3.25.1=testCompileClasspath,testRuntimeClasspath
16+
com.github.jnr:jffi:1.3.13=testRuntimeClasspath
17+
com.github.jnr:jnr-a64asm:1.0.0=testRuntimeClasspath
18+
com.github.jnr:jnr-constants:0.10.4=testRuntimeClasspath
19+
com.github.jnr:jnr-enxio:0.32.17=testRuntimeClasspath
20+
com.github.jnr:jnr-ffi:2.2.16=testRuntimeClasspath
21+
com.github.jnr:jnr-posix:3.1.19=testRuntimeClasspath
22+
com.github.jnr:jnr-unixsocket:0.38.22=testRuntimeClasspath
23+
com.github.jnr:jnr-x86asm:1.0.2=testRuntimeClasspath
24+
com.github.spotbugs:spotbugs-annotations:4.2.0=compileClasspath,testCompileClasspath,testRuntimeClasspath
25+
com.github.spotbugs:spotbugs-annotations:4.7.3=spotbugs
26+
com.github.spotbugs:spotbugs:4.7.3=spotbugs
27+
com.github.stefanbirkner:system-rules:1.19.0=testCompileClasspath,testRuntimeClasspath
28+
com.google.code.findbugs:jsr305:3.0.2=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
29+
com.google.code.gson:gson:2.9.1=spotbugs
30+
com.google.guava:guava:20.0=testCompileClasspath,testRuntimeClasspath
31+
com.google.re2j:re2j:1.7=testRuntimeClasspath
32+
com.squareup.moshi:moshi:1.11.0=testCompileClasspath,testRuntimeClasspath
33+
com.squareup.okhttp3:logging-interceptor:3.12.12=testCompileClasspath,testRuntimeClasspath
34+
com.squareup.okhttp3:okhttp:3.12.12=testCompileClasspath,testRuntimeClasspath
35+
com.squareup.okio:okio:1.17.5=testCompileClasspath,testRuntimeClasspath
36+
com.thoughtworks.qdox:qdox:1.12.1=testRuntimeClasspath
37+
commons-codec:commons-codec:1.15=spotbugs
38+
commons-fileupload:commons-fileupload:1.5=testCompileClasspath,testRuntimeClasspath
39+
commons-io:commons-io:2.11.0=testCompileClasspath,testRuntimeClasspath
40+
de.thetaphi:forbiddenapis:3.1=compileClasspath
41+
info.picocli:picocli:4.6.3=testRuntimeClasspath
42+
io.sqreen:libsqreen:10.1.0=testRuntimeClasspath
43+
javax.servlet:javax.servlet-api:3.1.0=testCompileClasspath,testRuntimeClasspath
44+
jaxen:jaxen:1.2.0=spotbugs
45+
jline:jline:2.14.6=testRuntimeClasspath
46+
junit:junit-dep:4.11=testCompileClasspath,testRuntimeClasspath
47+
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
48+
net.bytebuddy:byte-buddy-agent:1.14.18=testCompileClasspath,testRuntimeClasspath
49+
net.bytebuddy:byte-buddy:1.14.18=testCompileClasspath,testRuntimeClasspath
50+
net.java.dev.jna:jna-platform:5.8.0=testRuntimeClasspath
51+
net.java.dev.jna:jna:5.8.0=testRuntimeClasspath
52+
net.jcip:jcip-annotations:1.0=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
53+
net.sf.saxon:Saxon-HE:11.4=spotbugs
54+
org.apache.ant:ant-antlr:1.10.12=testRuntimeClasspath
55+
org.apache.ant:ant-antlr:1.9.15=codenarc
56+
org.apache.ant:ant-junit:1.10.12=testRuntimeClasspath
57+
org.apache.ant:ant-junit:1.9.15=codenarc
58+
org.apache.ant:ant-launcher:1.10.12=testRuntimeClasspath
59+
org.apache.ant:ant:1.10.12=testCompileClasspath,testRuntimeClasspath
60+
org.apache.bcel:bcel:6.5.0=spotbugs
61+
org.apache.commons:commons-lang3:3.12.0=spotbugs
62+
org.apache.commons:commons-text:1.10.0=spotbugs
63+
org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs
64+
org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs
65+
org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs
66+
org.apache.logging.log4j:log4j-api:2.19.0=spotbugs
67+
org.apache.logging.log4j:log4j-core:2.19.0=spotbugs
68+
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testRuntimeClasspath
69+
org.codehaus.groovy:groovy-all:3.0.17=testCompileClasspath,testRuntimeClasspath
70+
org.codehaus.groovy:groovy-ant:2.5.14=codenarc
71+
org.codehaus.groovy:groovy-ant:3.0.17=testCompileClasspath,testRuntimeClasspath
72+
org.codehaus.groovy:groovy-astbuilder:3.0.17=testCompileClasspath,testRuntimeClasspath
73+
org.codehaus.groovy:groovy-cli-picocli:3.0.17=testCompileClasspath,testRuntimeClasspath
74+
org.codehaus.groovy:groovy-console:3.0.17=testCompileClasspath,testRuntimeClasspath
75+
org.codehaus.groovy:groovy-datetime:3.0.17=testCompileClasspath,testRuntimeClasspath
76+
org.codehaus.groovy:groovy-docgenerator:3.0.17=testCompileClasspath,testRuntimeClasspath
77+
org.codehaus.groovy:groovy-groovydoc:2.5.14=codenarc
78+
org.codehaus.groovy:groovy-groovydoc:3.0.17=testCompileClasspath,testRuntimeClasspath
79+
org.codehaus.groovy:groovy-groovysh:3.0.17=testCompileClasspath,testRuntimeClasspath
80+
org.codehaus.groovy:groovy-jmx:3.0.17=testCompileClasspath,testRuntimeClasspath
81+
org.codehaus.groovy:groovy-json:2.5.14=codenarc
82+
org.codehaus.groovy:groovy-json:3.0.17=testCompileClasspath,testRuntimeClasspath
83+
org.codehaus.groovy:groovy-jsr223:3.0.17=testCompileClasspath,testRuntimeClasspath
84+
org.codehaus.groovy:groovy-macro:3.0.17=testCompileClasspath,testRuntimeClasspath
85+
org.codehaus.groovy:groovy-nio:3.0.17=testCompileClasspath,testRuntimeClasspath
86+
org.codehaus.groovy:groovy-servlet:3.0.17=testCompileClasspath,testRuntimeClasspath
87+
org.codehaus.groovy:groovy-sql:3.0.17=testCompileClasspath,testRuntimeClasspath
88+
org.codehaus.groovy:groovy-swing:3.0.17=testCompileClasspath,testRuntimeClasspath
89+
org.codehaus.groovy:groovy-templates:2.5.14=codenarc
90+
org.codehaus.groovy:groovy-templates:3.0.17=testCompileClasspath,testRuntimeClasspath
91+
org.codehaus.groovy:groovy-test-junit5:3.0.17=testCompileClasspath,testRuntimeClasspath
92+
org.codehaus.groovy:groovy-test:3.0.17=testCompileClasspath,testRuntimeClasspath
93+
org.codehaus.groovy:groovy-testng:3.0.17=testCompileClasspath,testRuntimeClasspath
94+
org.codehaus.groovy:groovy-xml:2.5.14=codenarc
95+
org.codehaus.groovy:groovy-xml:3.0.17=testCompileClasspath,testRuntimeClasspath
96+
org.codehaus.groovy:groovy:2.5.14=codenarc
97+
org.codehaus.groovy:groovy:3.0.17=testCompileClasspath,testRuntimeClasspath
98+
org.codenarc:CodeNarc:2.2.0=codenarc
99+
org.dom4j:dom4j:2.1.3=spotbugs
100+
org.eclipse.jetty:jetty-http:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
101+
org.eclipse.jetty:jetty-io:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
102+
org.eclipse.jetty:jetty-server:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
103+
org.eclipse.jetty:jetty-util:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
104+
org.gmetrics:GMetrics:1.1=codenarc
105+
org.hamcrest:hamcrest-core:1.3=testCompileClasspath,testRuntimeClasspath
106+
org.hamcrest:hamcrest:2.2=testCompileClasspath,testRuntimeClasspath
107+
org.jctools:jctools-core:3.3.0=testRuntimeClasspath
108+
org.junit.jupiter:junit-jupiter-api:5.9.2=testCompileClasspath,testRuntimeClasspath
109+
org.junit.jupiter:junit-jupiter-engine:5.9.2=testRuntimeClasspath
110+
org.junit.jupiter:junit-jupiter-params:5.9.0=testCompileClasspath,testRuntimeClasspath
111+
org.junit.jupiter:junit-jupiter:5.9.0=testCompileClasspath,testRuntimeClasspath
112+
org.junit.platform:junit-platform-commons:1.9.2=testCompileClasspath,testRuntimeClasspath
113+
org.junit.platform:junit-platform-engine:1.9.0=testCompileClasspath
114+
org.junit.platform:junit-platform-engine:1.9.2=testRuntimeClasspath
115+
org.junit.platform:junit-platform-launcher:1.9.2=testRuntimeClasspath
116+
org.junit.platform:junit-platform-runner:1.9.0=testRuntimeClasspath
117+
org.junit.platform:junit-platform-suite-api:1.9.0=testRuntimeClasspath
118+
org.junit.platform:junit-platform-suite-commons:1.9.0=testRuntimeClasspath
119+
org.junit:junit-bom:5.9.0=testCompileClasspath,testRuntimeClasspath
120+
org.junit:junit-bom:5.9.1=spotbugs
121+
org.msgpack:msgpack-core:0.8.24=testRuntimeClasspath
122+
org.objenesis:objenesis:3.3=testCompileClasspath,testRuntimeClasspath
123+
org.opentest4j:opentest4j:1.2.0=testCompileClasspath,testRuntimeClasspath
124+
org.ow2.asm:asm-analysis:9.2=testRuntimeClasspath
125+
org.ow2.asm:asm-analysis:9.4=spotbugs
126+
org.ow2.asm:asm-commons:9.2=testRuntimeClasspath
127+
org.ow2.asm:asm-commons:9.4=spotbugs
128+
org.ow2.asm:asm-tree:9.2=testRuntimeClasspath
129+
org.ow2.asm:asm-tree:9.4=spotbugs
130+
org.ow2.asm:asm-util:9.2=testRuntimeClasspath
131+
org.ow2.asm:asm-util:9.4=spotbugs
132+
org.ow2.asm:asm:9.2=testRuntimeClasspath
133+
org.ow2.asm:asm:9.4=spotbugs
134+
org.slf4j:jcl-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
135+
org.slf4j:jul-to-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
136+
org.slf4j:log4j-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
137+
org.slf4j:slf4j-api:1.7.30=testCompileClasspath
138+
org.slf4j:slf4j-api:1.7.32=testRuntimeClasspath
139+
org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j
140+
org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j
141+
org.spockframework:spock-core:2.2-groovy-3.0=testCompileClasspath,testRuntimeClasspath
142+
org.spockframework:spock-junit4:2.2-groovy-3.0=testCompileClasspath,testRuntimeClasspath
143+
org.testng:testng:7.5=testRuntimeClasspath
144+
org.webjars:jquery:3.5.1=testRuntimeClasspath
145+
org.xmlresolver:xmlresolver:4.4.3=spotbugs
146+
xml-apis:xml-apis:1.4.01=spotbugs
147+
empty=annotationProcessor,runtimeClasspath,spotbugsPlugins,testAnnotationProcessor

0 commit comments

Comments
 (0)