Skip to content

Commit

Permalink
fix(smoke-tests): Fix crash tracking setup (#8037)
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectSlayer authored Dec 2, 2024
1 parent 9f01834 commit 626485f
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<String> 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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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
}

Expand Down

0 comments on commit 626485f

Please sign in to comment.