Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smoke test for quarkus native #7525

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dd-smoke-tests/quarkus-native/application/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore all project specific gradle directories/files
.gradle
gradle
build
gradlew
gradlew.bat


29 changes: 29 additions & 0 deletions dd-smoke-tests/quarkus-native/application/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id 'java'
id 'io.quarkus'
id "com.diffplug.spotless" version "6.13.0"
}

def sharedRootDir = "$rootDir/../../../"
def sharedConfigDirectory = "$sharedRootDir/gradle"
rootProject.ext.sharedConfigDirectory = sharedConfigDirectory

apply from: "$sharedConfigDirectory/repositories.gradle"
apply from: "$sharedConfigDirectory/spotless.gradle"

if (hasProperty('appBuildDir')) {
buildDir = property('appBuildDir')
}

version = ""

dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy'
if (hasProperty('apiJar')) {
implementation files(property('apiJar'))
} else {
implementation "com.datadoghq:dd-trace-api:1.38.1"
}
}

4 changes: 4 additions & 0 deletions dd-smoke-tests/quarkus-native/application/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
quarkusPluginVersion=3.12.1
quarkusPlatformArtifactId=quarkus-universe-bom
quarkusPlatformGroupId=io.quarkus
quarkusPlatformVersion=3.12.1
25 changes: 25 additions & 0 deletions dd-smoke-tests/quarkus-native/application/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
plugins {
id 'io.quarkus' version "${quarkusPluginVersion}"
}
}

def isCI = System.getenv("CI") != null

// Don't pollute the dependency cache with the build cache
if (isCI) {
def sharedRootDir = "$rootDir/../../../"
buildCache {
local {
// This needs to line up with the code in the outer project settings.gradle
directory = "$sharedRootDir/workspace/build-cache"
}
}
}

rootProject.name='quarkus-native-smoketest'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package datadog.smoketest;

import datadog.trace.api.GlobalTracer;
import datadog.trace.api.Tracer;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import org.jboss.logging.Logger;

@Path("/hello-jboss")
public class JBossLoggingResource {
Logger log = Logger.getLogger(JBossLoggingResource.class);

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello(@DefaultValue("0") @QueryParam("id") int id) {
Tracer tracer = GlobalTracer.get();
log.debug("TT|" + tracer.getTraceId() + "|TS|" + tracer.getSpanId());
return "Hello " + id + "!";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package datadog.smoketest;

import datadog.trace.api.GlobalTracer;
import datadog.trace.api.Tracer;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Path("/hello-slf4j")
public class Slf4JResource {
Logger log = LoggerFactory.getLogger(Slf4JResource.class);

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello(@DefaultValue("0") @QueryParam("id") int id) {
Tracer tracer = GlobalTracer.get();
log.debug("TT|" + tracer.getTraceId() + "|TS|" + tracer.getSpanId());
return "Hello " + id + "!";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Nothing to see here!</title>
</head>
<body>
<h1>Nothing to see here!</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
quarkus.log.level=INFO
quarkus.log.category."datadog.smoketest".level=DEBUG
quarkus.log.console.format=%d %-5p [%c] '%t' |MT|%X{dd.trace_id}|MS|%X{dd.span_id}|%m%e%n

88 changes: 88 additions & 0 deletions dd-smoke-tests/quarkus-native/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apply from: "$rootDir/gradle/java.gradle"

dependencies {
testImplementation project(':dd-smoke-tests')
}
def testJvm = gradle.startParameter.projectProperties.getOrDefault('testJvm', '')
// In order to support GraalVM 21 we need at least Java 17 for Gradle
def java17Home = System.getenv('JAVA_17_HOME')
// Check 'testJvm' gradle command parameter to be at least GraalVM 17
def matcher = testJvm?.toLowerCase(Locale.ROOT) =~ /graalvm([0-9]+)/
def version = matcher?.size() == 1 ? Integer.parseInt(matcher[0][1]) : -1
if (version >= 17) {
// Retrieve GRAALVM_HOME from JVM environment variables
def testJvmEnv = "JAVA_${testJvm}_HOME"
def testJvmHome = System.getenv(testJvmEnv)
if (!testJvmHome) {
throw new GradleException("Unable to find launcher for Java '$testJvm'. Have you set '$testJvmEnv'?")
}
def javaHome = version >= 21 ? java17Home : testJvmHome
// Configure build directory for application
def appDir = "$projectDir/application"
def appBuildDir = "$buildDir/application"
def isWindows = System.getProperty('os.name').toLowerCase().contains('win')
def gradlewCommand = isWindows ? 'gradlew.bat' : 'gradlew'

// Define the task that builds the project
tasks.register('quarkusNativeBuild', Exec) {
workingDir "$appDir"
environment += [
'GRADLE_OPTS' : "-Dorg.gradle.jvmargs='-Xmx512M'",
'JAVA_HOME' : javaHome,
'GRAALVM_HOME': testJvmHome
]
commandLine(
"$rootDir/${gradlewCommand}",
'build',
'--no-daemon',
'--max-workers=4',
"-Dquarkus.native.enabled=true",
"-Dquarkus.package.jar.enabled=false",
"-PappBuildDir=$appBuildDir",
"-PapiJar=${project(':dd-trace-api').tasks.jar.archiveFile.get()}",
"-Dquarkus.native.additional-build-args=-J-javaagent:${project(':dd-java-agent').tasks.shadowJar.archiveFile.get()}," +
"-J-Ddatadog.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSS'Z [dd.trace]',-march=native"
)
outputs.cacheIf { true }
outputs.dir(appBuildDir)
.withPropertyName('nativeApplication')
inputs.files(fileTree(appDir) {
include '**/*'
exclude '.gradle/**'
}).withPropertyName('application')
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.file(project(':dd-trace-api').tasks.jar.archiveFile.get()).withPropertyName('apiJar')
inputs.file(project(':dd-java-agent').tasks.shadowJar.archiveFile.get()).withPropertyName('agentJar')
}

quarkusNativeBuild {
dependsOn project(':dd-trace-api').tasks.named("jar") // Use dev @Trace annotation
dependsOn project(':dd-java-agent').tasks.named('shadowJar') // Use dev agent
}

tasks.named('compileTestGroovy').configure {
dependsOn 'quarkusNativeBuild'
outputs.upToDateWhen {
!quarkusNativeBuild.didWork
}
}

tasks.withType(Test).configureEach {
jvmArgs "-Ddatadog.smoketest.quarkus.native.executable=$appBuildDir/quarkus-native-smoketest--runner"
}

} else {
tasks.withType(Test).configureEach {
enabled = false
}
}

spotless {
java {
target "**/*.java"
}

groovyGradle {
target '*.gradle', "**/*.gradle"
}
}
147 changes: 147 additions & 0 deletions dd-smoke-tests/quarkus-native/gradle.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
cafe.cryptography:curve25519-elisabeth:0.1.0=testRuntimeClasspath
cafe.cryptography:ed25519-elisabeth:0.1.0=testRuntimeClasspath
ch.qos.logback:logback-classic:1.2.3=testCompileClasspath,testRuntimeClasspath
ch.qos.logback:logback-core:1.2.3=testCompileClasspath,testRuntimeClasspath
com.beust:jcommander:1.78=testRuntimeClasspath
com.blogspot.mydailyjava:weak-lock-free:0.17=testCompileClasspath,testRuntimeClasspath
com.datadoghq.okhttp3:okhttp:3.12.15=testCompileClasspath,testRuntimeClasspath
com.datadoghq.okio:okio:1.17.6=testCompileClasspath,testRuntimeClasspath
com.datadoghq:dd-javac-plugin-client:0.1.7=testCompileClasspath,testRuntimeClasspath
com.datadoghq:java-dogstatsd-client:4.4.0=testRuntimeClasspath
com.datadoghq:sketches-java:0.8.3=testRuntimeClasspath
com.github.javaparser:javaparser-core:3.25.1=testCompileClasspath,testRuntimeClasspath
com.github.jnr:jffi:1.3.13=testRuntimeClasspath
com.github.jnr:jnr-a64asm:1.0.0=testRuntimeClasspath
com.github.jnr:jnr-constants:0.10.4=testRuntimeClasspath
com.github.jnr:jnr-enxio:0.32.17=testRuntimeClasspath
com.github.jnr:jnr-ffi:2.2.16=testRuntimeClasspath
com.github.jnr:jnr-posix:3.1.19=testRuntimeClasspath
com.github.jnr:jnr-unixsocket:0.38.22=testRuntimeClasspath
com.github.jnr:jnr-x86asm:1.0.2=testRuntimeClasspath
com.github.spotbugs:spotbugs-annotations:4.2.0=compileClasspath,testCompileClasspath,testRuntimeClasspath
com.github.spotbugs:spotbugs-annotations:4.7.3=spotbugs
com.github.spotbugs:spotbugs:4.7.3=spotbugs
com.github.stefanbirkner:system-rules:1.19.0=testCompileClasspath,testRuntimeClasspath
com.google.code.findbugs:jsr305:3.0.2=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
com.google.code.gson:gson:2.9.1=spotbugs
com.google.guava:guava:20.0=testCompileClasspath,testRuntimeClasspath
com.google.re2j:re2j:1.7=testRuntimeClasspath
com.squareup.moshi:moshi:1.11.0=testCompileClasspath,testRuntimeClasspath
com.squareup.okhttp3:logging-interceptor:3.12.12=testCompileClasspath,testRuntimeClasspath
com.squareup.okhttp3:okhttp:3.12.12=testCompileClasspath,testRuntimeClasspath
com.squareup.okio:okio:1.17.5=testCompileClasspath,testRuntimeClasspath
com.thoughtworks.qdox:qdox:1.12.1=testRuntimeClasspath
commons-codec:commons-codec:1.15=spotbugs
commons-fileupload:commons-fileupload:1.5=testCompileClasspath,testRuntimeClasspath
commons-io:commons-io:2.11.0=testCompileClasspath,testRuntimeClasspath
de.thetaphi:forbiddenapis:3.1=compileClasspath
info.picocli:picocli:4.6.3=testRuntimeClasspath
io.sqreen:libsqreen:10.1.0=testRuntimeClasspath
javax.servlet:javax.servlet-api:3.1.0=testCompileClasspath,testRuntimeClasspath
jaxen:jaxen:1.2.0=spotbugs
jline:jline:2.14.6=testRuntimeClasspath
junit:junit-dep:4.11=testCompileClasspath,testRuntimeClasspath
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy-agent:1.14.18=testCompileClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy:1.14.18=testCompileClasspath,testRuntimeClasspath
net.java.dev.jna:jna-platform:5.8.0=testRuntimeClasspath
net.java.dev.jna:jna:5.8.0=testRuntimeClasspath
net.jcip:jcip-annotations:1.0=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
net.sf.saxon:Saxon-HE:11.4=spotbugs
org.apache.ant:ant-antlr:1.10.12=testRuntimeClasspath
org.apache.ant:ant-antlr:1.9.15=codenarc
org.apache.ant:ant-junit:1.10.12=testRuntimeClasspath
org.apache.ant:ant-junit:1.9.15=codenarc
org.apache.ant:ant-launcher:1.10.12=testRuntimeClasspath
org.apache.ant:ant:1.10.12=testCompileClasspath,testRuntimeClasspath
org.apache.bcel:bcel:6.5.0=spotbugs
org.apache.commons:commons-lang3:3.12.0=spotbugs
org.apache.commons:commons-text:1.10.0=spotbugs
org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs
org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs
org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs
org.apache.logging.log4j:log4j-api:2.19.0=spotbugs
org.apache.logging.log4j:log4j-core:2.19.0=spotbugs
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-all:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-ant:2.5.14=codenarc
org.codehaus.groovy:groovy-ant:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-astbuilder:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-cli-picocli:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-console:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-datetime:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-docgenerator:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-groovydoc:2.5.14=codenarc
org.codehaus.groovy:groovy-groovydoc:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-groovysh:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-jmx:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-json:2.5.14=codenarc
org.codehaus.groovy:groovy-json:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-jsr223:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-macro:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-nio:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-servlet:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-sql:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-swing:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-templates:2.5.14=codenarc
org.codehaus.groovy:groovy-templates:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-test-junit5:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-test:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-testng:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy-xml:2.5.14=codenarc
org.codehaus.groovy:groovy-xml:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codehaus.groovy:groovy:2.5.14=codenarc
org.codehaus.groovy:groovy:3.0.17=testCompileClasspath,testRuntimeClasspath
org.codenarc:CodeNarc:2.2.0=codenarc
org.dom4j:dom4j:2.1.3=spotbugs
org.eclipse.jetty:jetty-http:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-io:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-server:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-util:9.2.30.v20200428=testCompileClasspath,testRuntimeClasspath
org.gmetrics:GMetrics:1.1=codenarc
org.hamcrest:hamcrest-core:1.3=testCompileClasspath,testRuntimeClasspath
org.hamcrest:hamcrest:2.2=testCompileClasspath,testRuntimeClasspath
org.jctools:jctools-core:3.3.0=testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.9.2=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-engine:5.9.2=testRuntimeClasspath
org.junit.jupiter:junit-jupiter-params:5.9.0=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter:5.9.0=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.9.2=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.9.0=testCompileClasspath
org.junit.platform:junit-platform-engine:1.9.2=testRuntimeClasspath
org.junit.platform:junit-platform-launcher:1.9.2=testRuntimeClasspath
org.junit.platform:junit-platform-runner:1.9.0=testRuntimeClasspath
org.junit.platform:junit-platform-suite-api:1.9.0=testRuntimeClasspath
org.junit.platform:junit-platform-suite-commons:1.9.0=testRuntimeClasspath
org.junit:junit-bom:5.9.0=testCompileClasspath,testRuntimeClasspath
org.junit:junit-bom:5.9.1=spotbugs
org.msgpack:msgpack-core:0.8.24=testRuntimeClasspath
org.objenesis:objenesis:3.3=testCompileClasspath,testRuntimeClasspath
org.opentest4j:opentest4j:1.2.0=testCompileClasspath,testRuntimeClasspath
org.ow2.asm:asm-analysis:9.2=testRuntimeClasspath
org.ow2.asm:asm-analysis:9.4=spotbugs
org.ow2.asm:asm-commons:9.2=testRuntimeClasspath
org.ow2.asm:asm-commons:9.4=spotbugs
org.ow2.asm:asm-tree:9.2=testRuntimeClasspath
org.ow2.asm:asm-tree:9.4=spotbugs
org.ow2.asm:asm-util:9.2=testRuntimeClasspath
org.ow2.asm:asm-util:9.4=spotbugs
org.ow2.asm:asm:9.2=testRuntimeClasspath
org.ow2.asm:asm:9.4=spotbugs
org.slf4j:jcl-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
org.slf4j:jul-to-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
org.slf4j:log4j-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:1.7.30=testCompileClasspath
org.slf4j:slf4j-api:1.7.32=testRuntimeClasspath
org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j
org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j
org.spockframework:spock-core:2.2-groovy-3.0=testCompileClasspath,testRuntimeClasspath
org.spockframework:spock-junit4:2.2-groovy-3.0=testCompileClasspath,testRuntimeClasspath
org.testng:testng:7.5=testRuntimeClasspath
org.webjars:jquery:3.5.1=testRuntimeClasspath
org.xmlresolver:xmlresolver:4.4.3=spotbugs
xml-apis:xml-apis:1.4.01=spotbugs
empty=annotationProcessor,runtimeClasspath,spotbugsPlugins,testAnnotationProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package datadog.smoketest

class QuarkusJBossLoggingSmokeTest extends QuarkusNativeSmokeTest {
@Override
String helloEndpointName() {
return "hello-jboss"
}

@Override
String resourceName() {
return "[datadog.smoketest.JBossLoggingResource]"
}
}
Loading
Loading