Isolate the effects of initializing Reactor's debug agent in the tests

pull/18579/head
Andy Wilkinson 5 years ago
parent e7efe0cbfe
commit 3fc51f8063

@ -86,11 +86,6 @@
<artifactId>reactor-netty</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-tools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>

@ -16,8 +16,6 @@
package org.springframework.boot.reactor;
import reactor.tools.agent.ReactorDebugAgent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
@ -46,7 +44,13 @@ public class DebugAgentEnvironmentPostProcessor implements EnvironmentPostProces
if (ClassUtils.isPresent(REACTOR_DEBUGAGENT_CLASS, null)) {
Boolean agentEnabled = environment.getProperty(DEBUGAGENT_ENABLED_CONFIG_KEY, Boolean.class);
if (agentEnabled != Boolean.FALSE) {
ReactorDebugAgent.init();
try {
Class<?> debugAgent = Class.forName(REACTOR_DEBUGAGENT_CLASS);
debugAgent.getMethod("init").invoke(null);
}
catch (Exception ex) {
throw new RuntimeException("Failed to init Reactor's debug agent");
}
}
}
}

@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import reactor.core.Scannable;
import reactor.core.publisher.Flux;
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.mock.env.MockEnvironment;
import static org.assertj.core.api.Assertions.assertThat;
@ -29,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Brian Clozel
*/
@ClassPathOverrides("io.projectreactor:reactor-tools:3.3.0.RELEASE")
class DebugAgentEnvironmentPostProcessorTests {
static {

Loading…
Cancel
Save