Skip to content

Commit 264e86b

Browse files
mccullssezen-datadog
authored andcommitted
Ensure net.bytebuddy.raw is set to true when ConfigTransformSpockExtension is installed (#8728)
This matches the same setting used by AgentInstaller which avoids spurious test failures in agent-tooling, specifically TypeFactoryForkedTest. This requires raw-types enabled to match the behaviour when installing the tracer with -javaagent. Without this byte-buddy will use dufferent code paths involving generic checks, which can lead to test failures using recent versions of byte-buddy (specifically going between full and outline types, where outlines are always raw-types by their nature.) These failures would not happen when using -javaagent because AgentInstaller forces the use of the raw-types setting. ConfigTransformSpockExtension should therefore do the same. Note we can't set this property in TypeFactoryForkedTest because by then it is too late, byte-buddy is already confgured by ConfigTransformSpockExtension and the raw-types value cannot be changed.
1 parent ec2a6fb commit 264e86b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils/test-utils/src/main/groovy/datadog/trace/test/util/ConfigTransformSpockExtension.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import static net.bytebuddy.matcher.ElementMatchers.none
1818
* Transforms the Config class to make its INSTANCE field non-final and volatile.
1919
*/
2020
class ConfigTransformSpockExtension implements IGlobalExtension {
21+
static {
22+
// same setting as AgentInstaller to avoid spurious agent-tooling test failures
23+
System.setProperty("net.bytebuddy.raw", "true")
24+
}
25+
2126
static final String INST_CONFIG = "datadog.trace.api.InstrumenterConfig"
2227
static final String CONFIG = "datadog.trace.api.Config"
2328

0 commit comments

Comments
 (0)