Fix failing tests
Add TracingAgent to list of bootstrap class Fix renaming tests Fix JMXFetch path splitting
This commit is contained in:
parent
c275143eae
commit
c41536cbe2
|
@ -105,7 +105,7 @@ public class DatadogClassLoader extends URLClassLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BootstrapClassLoaderProxy(final URL[] urls) {
|
public BootstrapClassLoaderProxy(final URL[] urls) {
|
||||||
super(urls);
|
super(urls, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -155,7 +155,15 @@ public class JMXFetch {
|
||||||
integrationName.add(config.replace(".yaml", ""));
|
integrationName.add(config.replace(".yaml", ""));
|
||||||
if (Config.get().isJmxFetchIntegrationEnabled(integrationName, false)) {
|
if (Config.get().isJmxFetchIntegrationEnabled(integrationName, false)) {
|
||||||
final URL resource = JMXFetch.class.getResource("metricconfigs/" + config);
|
final URL resource = JMXFetch.class.getResource("metricconfigs/" + config);
|
||||||
result.add(resource.getPath().split("\\.jar!/")[1]);
|
|
||||||
|
// jar!/ means a file internal to a jar, only add the part after if it exists
|
||||||
|
final String path = resource.getPath();
|
||||||
|
final int filenameIndex = path.indexOf("jar!/");
|
||||||
|
if (filenameIndex != -1) {
|
||||||
|
result.add(path.substring(filenameIndex + 5));
|
||||||
|
} else {
|
||||||
|
result.add(path.substring(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -14,6 +14,7 @@ public final class Constants {
|
||||||
*/
|
*/
|
||||||
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES = {
|
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES = {
|
||||||
"datadog.slf4j",
|
"datadog.slf4j",
|
||||||
|
"datadog.trace.agent.TracingAgent",
|
||||||
"datadog.trace.api",
|
"datadog.trace.api",
|
||||||
"datadog.trace.bootstrap",
|
"datadog.trace.bootstrap",
|
||||||
"datadog.trace.context",
|
"datadog.trace.context",
|
||||||
|
|
|
@ -14,23 +14,23 @@ class ShadowPackageRenamingTest extends Specification {
|
||||||
final Class<?> ddClass =
|
final Class<?> ddClass =
|
||||||
IntegrationTestUtils.getAgentClassLoader()
|
IntegrationTestUtils.getAgentClassLoader()
|
||||||
.loadClass("datadog.trace.agent.tooling.AgentInstaller")
|
.loadClass("datadog.trace.agent.tooling.AgentInstaller")
|
||||||
final String userGuava =
|
final URL userGuava =
|
||||||
MapMaker.getProtectionDomain().getCodeSource().getLocation().getFile()
|
MapMaker.getProtectionDomain().getCodeSource().getLocation()
|
||||||
final String agentGuavaDep =
|
final URL agentGuavaDep =
|
||||||
ddClass
|
ddClass
|
||||||
.getClassLoader()
|
.getClassLoader()
|
||||||
.loadClass("com.google.common.collect.MapMaker")
|
.loadClass("com.google.common.collect.MapMaker")
|
||||||
.getProtectionDomain()
|
.getProtectionDomain()
|
||||||
.getCodeSource()
|
.getCodeSource()
|
||||||
.getLocation()
|
.getLocation()
|
||||||
.getFile()
|
final URL agentSource =
|
||||||
final String agentSource =
|
ddClass.getProtectionDomain().getCodeSource().getLocation()
|
||||||
ddClass.getProtectionDomain().getCodeSource().getLocation().getFile()
|
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
agentSource.matches(".*/agent-tooling-and-instrumentation[^/]*.jar")
|
agentSource.getFile() == "/"
|
||||||
|
agentSource.getProtocol() == "x-internal-jar"
|
||||||
agentSource == agentGuavaDep
|
agentSource == agentGuavaDep
|
||||||
agentSource != userGuava
|
agentSource.getFile() != userGuava.getFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
def "java getLogger rewritten to safe logger"() {
|
def "java getLogger rewritten to safe logger"() {
|
||||||
|
|
Loading…
Reference in New Issue