Adding @DirtiesContext on spring tests to fix conflicts 19/142119/1
authoradheli.tavares <adheli.tavares@est.tech>
Thu, 25 Sep 2025 10:36:54 +0000 (11:36 +0100)
committerAdheli Tavares <adheli.tavares@est.tech>
Thu, 25 Sep 2025 10:56:37 +0000 (10:56 +0000)
Issue-ID: POLICY-5457
Change-Id: I05b83fefc10afa12358aa268e25c65a26942e013
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/AcSimRestTest.java
participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java

index 6d02edd..91ea18d 100644 (file)
@@ -48,6 +48,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.http.MediaType;
+import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.bean.override.mockito.MockitoBean;
 import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.springframework.test.web.servlet.MockMvc;
@@ -59,6 +60,7 @@ import org.springframework.web.context.WebApplicationContext;
 @WebMvcTest(value = SimulatorController.class)
 @Import({MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class})
 @EnableConfigurationProperties(value = ParticipantSimParameters.class)
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
 class AcSimRestTest {
 
     private static final Coder CODER = new StandardCoder();
index a3bf682..681a62f 100644 (file)
@@ -31,6 +31,7 @@ import org.springframework.boot.test.autoconfigure.actuate.observability.AutoCon
 import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.web.reactive.server.WebTestClient;
 import org.springframework.web.reactive.function.client.ExchangeFilterFunctions;
@@ -39,6 +40,7 @@ import org.springframework.web.reactive.function.client.ExchangeFilterFunctions;
 @AutoConfigureWebTestClient
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
 @ActiveProfiles("test")
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
 class ActuatorControllerTest {
 
     @Autowired