Skip to content

Commit 446caf0

Browse files
Introduced more granular test exclusions for SecurityManager behavior under Java 24+. (#9208)
1 parent c938629 commit 446caf0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

dd-java-agent/src/test/groovy/datadog/trace/agent/InitializationTelemetryTest.groovy

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import spock.lang.Specification
88
import spock.lang.Timeout
99

1010
@Timeout(30)
11-
@IgnoreIf(reason = "SecurityManager is permanently disabled as of JDK 24", value = {
12-
JavaVirtualMachine.isJavaVersionAtLeast(24)
13-
})
1411
class InitializationTelemetryTest extends Specification {
12+
@IgnoreIf(reason = "SecurityManager is permanently disabled as of JDK 24", value = {
13+
JavaVirtualMachine.isJavaVersionAtLeast(24)
14+
})
1515
def "block agent start-up"() {
1616
// In this case, the SecurityManager blocks loading of the Premain Class,
1717
// so the JVM is expected to terminate with an error
@@ -53,6 +53,9 @@ class InitializationTelemetryTest extends Specification {
5353
agent.close()
5454
}
5555

56+
@IgnoreIf(reason = "SecurityManager is permanently disabled as of JDK 24", value = {
57+
JavaVirtualMachine.isJavaVersionAtLeast(24)
58+
})
5659
def "incomplete agent start-up"() {
5760
// In this case, the SecurityManager blocks a custom permission that is checked by bytebuddy causing
5861
// agent initialization to fail. However, we should catch the exception allowing the application
@@ -66,6 +69,9 @@ class InitializationTelemetryTest extends Specification {
6669
result.telemetryJson.contains('error_type:java.lang.IllegalStateException')
6770
}
6871

72+
@IgnoreIf(reason = "SecurityManager is permanently disabled as of JDK 24", value = {
73+
JavaVirtualMachine.isJavaVersionAtLeast(24)
74+
})
6975
def "block forwarder env var"() {
7076
// In this case, the SecurityManager blocks access to the forwarder environment variable,
7177
// so the tracer is unable to report initialization telemetry
@@ -78,6 +84,9 @@ class InitializationTelemetryTest extends Specification {
7884
result.telemetryJson == null
7985
}
8086

87+
@IgnoreIf(reason = "SecurityManager is permanently disabled as of JDK 24", value = {
88+
JavaVirtualMachine.isJavaVersionAtLeast(24)
89+
})
8190
def "block forwarder execution"() {
8291
// In this case, the SecurityManager blocks access to process execution, so the tracer is
8392
// unable to invoke the forwarder executable

0 commit comments

Comments
 (0)