diff --git a/dd-smoke-tests/jersey-2/src/test/groovy/datadog/smoketest/Jersey2SmokeTest.groovy b/dd-smoke-tests/jersey-2/src/test/groovy/datadog/smoketest/Jersey2SmokeTest.groovy index 506a1f6c90b..120d34c2a08 100644 --- a/dd-smoke-tests/jersey-2/src/test/groovy/datadog/smoketest/Jersey2SmokeTest.groovy +++ b/dd-smoke-tests/jersey-2/src/test/groovy/datadog/smoketest/Jersey2SmokeTest.groovy @@ -21,7 +21,7 @@ class Jersey2SmokeTest extends AbstractJerseySmokeTest { if (Platform.isJavaVersionAtLeast(17)) { command.addAll((String[]) ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']) } - command.addAll((String[]) ['-jar', jarPath, httpPort]) + command.addAll(['-jar', jarPath, Integer.toString(httpPort)]) ProcessBuilder processBuilder = new ProcessBuilder(command) processBuilder.directory(new File(buildDirectory)) return processBuilder diff --git a/dd-smoke-tests/jersey-3/src/test/groovy/datadog/smoketest/Jersey3SmokeTest.groovy b/dd-smoke-tests/jersey-3/src/test/groovy/datadog/smoketest/Jersey3SmokeTest.groovy index 529348fba98..4ee050d62f4 100644 --- a/dd-smoke-tests/jersey-3/src/test/groovy/datadog/smoketest/Jersey3SmokeTest.groovy +++ b/dd-smoke-tests/jersey-3/src/test/groovy/datadog/smoketest/Jersey3SmokeTest.groovy @@ -19,7 +19,7 @@ class Jersey3SmokeTest extends AbstractJerseySmokeTest { command.add(withSystemProperty('integration.grizzly.enabled', true)) //command.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000") //command.add("-Xdebug") - command.addAll((String[]) ['-jar', jarPath, httpPort]) + command.addAll(['-jar', jarPath, Integer.toString(httpPort)]) ProcessBuilder processBuilder = new ProcessBuilder(command) processBuilder.directory(new File(buildDirectory)) return processBuilder diff --git a/dd-smoke-tests/play-2.4/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy b/dd-smoke-tests/play-2.4/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy index a67d0c2397d..9559dfa3538 100644 --- a/dd-smoke-tests/play-2.4/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy +++ b/dd-smoke-tests/play-2.4/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy @@ -49,7 +49,7 @@ class PlayNettySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.5/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy b/dd-smoke-tests/play-2.5/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy index 5e786c6c8a6..b5ddcaad542 100644 --- a/dd-smoke-tests/play-2.5/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy +++ b/dd-smoke-tests/play-2.5/src/test/groovy/datadog/smoketest/PlayNettySmokeTest.groovy @@ -47,7 +47,7 @@ class PlayNettySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.6/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy b/dd-smoke-tests/play-2.6/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy index b8a0a865e08..4e6f0877ff4 100644 --- a/dd-smoke-tests/play-2.6/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy +++ b/dd-smoke-tests/play-2.6/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy @@ -47,7 +47,7 @@ abstract class PlaySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.7/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy b/dd-smoke-tests/play-2.7/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy index e008b0828a5..c1fa4de7883 100644 --- a/dd-smoke-tests/play-2.7/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy +++ b/dd-smoke-tests/play-2.7/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy @@ -47,7 +47,7 @@ abstract class PlaySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.8-otel/src/test/groovy/datadog/smoketest/Play28OTelSmokeTest.groovy b/dd-smoke-tests/play-2.8-otel/src/test/groovy/datadog/smoketest/Play28OTelSmokeTest.groovy index 052b22f80e9..c814e0e4de6 100644 --- a/dd-smoke-tests/play-2.8-otel/src/test/groovy/datadog/smoketest/Play28OTelSmokeTest.groovy +++ b/dd-smoke-tests/play-2.8-otel/src/test/groovy/datadog/smoketest/Play28OTelSmokeTest.groovy @@ -47,7 +47,7 @@ abstract class Play28OTelSmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.8-split-routes/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy b/dd-smoke-tests/play-2.8-split-routes/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy index f44b1fad512..370cc9992ee 100644 --- a/dd-smoke-tests/play-2.8-split-routes/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy +++ b/dd-smoke-tests/play-2.8-split-routes/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy @@ -47,7 +47,7 @@ abstract class PlaySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/play-2.8/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy b/dd-smoke-tests/play-2.8/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy index 03c645345bd..66010d3832c 100644 --- a/dd-smoke-tests/play-2.8/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy +++ b/dd-smoke-tests/play-2.8/src/test/groovy/datadog/smoketest/PlaySmokeTest.groovy @@ -47,7 +47,7 @@ abstract class PlaySmokeTest extends AbstractServerSmokeTest { new ProcessBuilder("${playDirectory}/bin/${command}") processBuilder.directory(playDirectory) processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") + defaultJavaProperties.collect({ it.replace(' ', '\\ ')}).join(" ") + " -Dconfig.file=${playDirectory}/conf/application.conf" + " -Dhttp.port=${httpPort}" + " -Dhttp.address=127.0.0.1" diff --git a/dd-smoke-tests/resteasy/src/test/groovy/smoketest/ResteasySmokeTest.groovy b/dd-smoke-tests/resteasy/src/test/groovy/smoketest/ResteasySmokeTest.groovy index f24340966a5..b53ae383594 100644 --- a/dd-smoke-tests/resteasy/src/test/groovy/smoketest/ResteasySmokeTest.groovy +++ b/dd-smoke-tests/resteasy/src/test/groovy/smoketest/ResteasySmokeTest.groovy @@ -2,6 +2,7 @@ package smoketest import datadog.smoketest.AbstractIastServerSmokeTest import datadog.trace.api.Platform +import datadog.trace.api.config.IastConfig import okhttp3.Request import spock.lang.IgnoreIf @@ -18,14 +19,14 @@ class ResteasySmokeTest extends AbstractIastServerSmokeTest { command.add(javaPath()) command.addAll(defaultJavaProperties) command.addAll([ - withSystemProperty(datadog.trace.api.config.IastConfig.IAST_ENABLED, true), - withSystemProperty(datadog.trace.api.config.IastConfig.IAST_DETECTION_MODE, 'FULL'), - withSystemProperty(datadog.trace.api.config.IastConfig.IAST_DEBUG_ENABLED, true) + withSystemProperty(IastConfig.IAST_ENABLED, true), + withSystemProperty(IastConfig.IAST_DETECTION_MODE, 'FULL'), + withSystemProperty(IastConfig.IAST_DEBUG_ENABLED, true) ]) if (Platform.isJavaVersionAtLeast(17)) { - command.addAll((String[]) ["--add-opens", "java.base/java.lang=ALL-UNNAMED"]) + command.addAll(["--add-opens", "java.base/java.lang=ALL-UNNAMED"]) } - command.addAll((String[]) ["-jar", jarPath, httpPort]) + command.addAll(["-jar", jarPath, Integer.toString(httpPort)]) ProcessBuilder processBuilder = new ProcessBuilder(command) processBuilder.directory(new File(buildDirectory)) } diff --git a/dd-smoke-tests/springboot-tomcat/src/test/groovy/datadog/smoketest/SpringBootTomcatSmokeTest.groovy b/dd-smoke-tests/springboot-tomcat/src/test/groovy/datadog/smoketest/SpringBootTomcatSmokeTest.groovy index 9236c7d441b..53a88721c75 100644 --- a/dd-smoke-tests/springboot-tomcat/src/test/groovy/datadog/smoketest/SpringBootTomcatSmokeTest.groovy +++ b/dd-smoke-tests/springboot-tomcat/src/test/groovy/datadog/smoketest/SpringBootTomcatSmokeTest.groovy @@ -24,7 +24,7 @@ class SpringBootTomcatSmokeTest extends AbstractServerSmokeTest { def permissions = new HashSet<>(Files.getPosixFilePermissions(catalinaPath)) permissions.add(PosixFilePermission.OWNER_EXECUTE) Files.setPosixFilePermissions(catalinaPath, permissions) - } catch (Exception e) { + } catch (Exception ignored) { // not posix ... continue } Files.copy(springBootShadowWar, tomcatDirectory.resolve("webapps/smoke.war"), StandardCopyOption.REPLACE_EXISTING) @@ -40,9 +40,12 @@ class SpringBootTomcatSmokeTest extends AbstractServerSmokeTest { ProcessBuilder processBuilder = new ProcessBuilder("bin/catalina.sh", "run") processBuilder.directory(tomcatDirectory.toFile()) - defaultJavaProperties += "-Ddd.writer.type=TraceStructureWriter:${output.getAbsolutePath()}:includeService:includeResource" - defaultJavaProperties += "-Ddd.integration.spring-boot.enabled=true" - processBuilder.environment().put("CATALINA_OPTS", defaultJavaProperties.join(" ")) + List catalinaOpts = [ + *defaultJavaProperties, + "-Ddd.writer.type=TraceStructureWriter:${output.getAbsolutePath()}:includeService:includeResource", + "-Ddd.integration.spring-boot.enabled=true" + ] + processBuilder.environment().put("CATALINA_OPTS", catalinaOpts.collect({ it.replace(' ', '\\ ')}).join(" ")) return processBuilder } diff --git a/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy b/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy index 423ab6de925..17e33ce4aa4 100644 --- a/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy +++ b/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy @@ -198,7 +198,7 @@ abstract class AbstractSmokeTest extends ProcessManager { // DQH - Nov 2024 - skipping for J9 which doesn't have full crash tracking support if (testCrashTracking() && !Platform.isJ9()) { def extension = getScriptExtension() - ret += "-XX:OnError=\"${tmpDir}/dd_crash_uploader.${extension} %p\"" + ret += "-XX:OnError=${tmpDir}/dd_crash_uploader.${extension} %p" // Unlike crash tracking smoke test, keep the default delay; otherwise, otherwise other tests will fail // ret += "-Ddd.dogstatsd.start-delay=0" } diff --git a/dd-smoke-tests/wildfly/src/test/groovy/datadog/smoketest/WildflySmokeTest.groovy b/dd-smoke-tests/wildfly/src/test/groovy/datadog/smoketest/WildflySmokeTest.groovy index 924adb9e3fb..5da6a415260 100644 --- a/dd-smoke-tests/wildfly/src/test/groovy/datadog/smoketest/WildflySmokeTest.groovy +++ b/dd-smoke-tests/wildfly/src/test/groovy/datadog/smoketest/WildflySmokeTest.groovy @@ -20,10 +20,13 @@ class WildflySmokeTest extends AbstractServerSmokeTest { ProcessBuilder processBuilder = new ProcessBuilder("${wildflyDirectory}/bin/standalone.sh") processBuilder.directory(wildflyDirectory) - processBuilder.environment().put("JAVA_OPTS", - defaultJavaProperties.join(" ") - + " -Djboss.http.port=${httpPort} -Djboss.https.port=${httpsPort}" - + " -Djboss.management.http.port=${managementPort}") + List javaOpts = [ + *defaultJavaProperties, + "-Djboss.http.port=${httpPort}", + "-Djboss.https.port=${httpsPort}", + "-Djboss.management.http.port=${managementPort}" + ] + processBuilder.environment().put("JAVA_OPTS", javaOpts.collect({ it.replace(' ', '\\ ')}).join(' ')) return processBuilder }