diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/test/tools/AgentServiceRule.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/test/tools/AgentServiceRule.java index 29b5aff8b..80dfb187e 100644 --- a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/test/tools/AgentServiceRule.java +++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/test/tools/AgentServiceRule.java @@ -44,6 +44,12 @@ public class AgentServiceRule extends ExternalResource { @Override protected void before() throws Throwable { super.before(); + + Whitebox.setInternalState(ServiceManager.INSTANCE, "bootedServices", new HashMap()); + Whitebox.setInternalState(TracingContext.ListenerManager.class, "LISTENERS", new LinkedList()); + Whitebox.setInternalState(IgnoredTracerContext.ListenerManager.class, "LISTENERS", new LinkedList()); + Whitebox.setInternalState(TracingContext.TracingThreadListenerManager.class, "LISTENERS", new LinkedList()); + ServiceManager.INSTANCE.boot(); } }