Fix classloading integration tests
MODIFY
dd-java-agent-ittests/src/test/groovy/datadog/trace/agent/integration/classloading/ClassLoadingTest.groovy
dd-java-agent-ittests/src/test/groovy/datadog/trace/agent/integration/classloading/ClassLoadingTest.groovy
@@ -56,6 +56,7 @@ class ClassLoadingTest extends Specification {
@Override
URL getResource(String name) {
count++
+ return super.getResource(name)
}
}
@@ -65,10 +66,12 @@ class ClassLoadingTest extends Specification {
when:
loader.loadClass(ClassToInstrument.getName())
+ int countAfterFirstLoad = loader.count
loader.loadClass(ClassToInstrumentChild.getName())
then:
- loader.count == 2
+ // ClassToInstrumentChild won't cause an additional getResource() because its TypeDescription is created from transformation bytes.
+ loader.count == countAfterFirstLoad
}
def "make sure that ByteBuddy doesn't resue cached type descriptions between different classloaders"() {
@@ -81,8 +84,9 @@ class ClassLoadingTest extends Specification {
loader2.loadClass(ClassToInstrument.getName())
then:
- loader1.count == 1
- loader2.count == 1
+ loader1.count > 0
+ loader2.count > 0
+ loader1.count == loader2.count
}
def "can find bootstrap resources"() {

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/DDCachingPoolStrategy.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/DDCachingPoolStrategy.java
@@ -20,8 +20,6 @@ public class DDCachingPoolStrategy implements PoolStrategy {
synchronized (key) {
cache = typePoolCache.get(key);
if (null == cache) {
- // new TypePool.Default.WithLazyResolution(TypePool.CacheProvider.Simple.withObjectType(),
- // classFileLocator, TypePool.Default.ReaderMode.FAST);
cache = TypePool.CacheProvider.Simple.withObjectType();
typePoolCache.put(key, cache);
}

Fix classloading integration tests