Skip to content

Commit 663243e

Browse files
committed
Fix open telemetry container lifecycle issues
Mark test as `@DirtiesContext` so that the context is closed before the container. Closes gh-38176
1 parent 9b71ef4 commit 663243e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/otlp/OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
4141
import org.springframework.context.annotation.Bean;
4242
import org.springframework.context.annotation.Configuration;
43+
import org.springframework.test.annotation.DirtiesContext;
4344
import org.springframework.test.context.TestPropertySource;
4445
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4546

@@ -57,6 +58,7 @@
5758
@TestPropertySource(properties = { "management.otlp.metrics.export.resource-attributes.service.name=test",
5859
"management.otlp.metrics.export.step=1s" })
5960
@Testcontainers(disabledWithoutDocker = true)
61+
@DirtiesContext
6062
class OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests {
6163

6264
private static final String OPENMETRICS_001 = "application/openmetrics-text; version=0.0.1; charset=utf-8";

0 commit comments

Comments
 (0)