Skip to content

Commit 138307c

Browse files
committed
Disable test context cache in spring-boot-testcontainers
Closes gh-41124
1 parent 03a87cc commit 138307c

File tree

5 files changed

+3
-10
lines changed

5 files changed

+3
-10
lines changed

spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestContainersParallelStartupIntegrationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
2727
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
2828
import org.springframework.context.annotation.Bean;
2929
import org.springframework.context.annotation.Configuration;
30-
import org.springframework.test.annotation.DirtiesContext;
3130
import org.springframework.test.context.ContextConfiguration;
3231
import org.springframework.test.context.TestPropertySource;
3332
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -42,7 +41,6 @@
4241
@ExtendWith(SpringExtension.class)
4342
@ContextConfiguration(classes = ContainerConfig.class)
4443
@TestPropertySource(properties = "spring.testcontainers.beans.startup=parallel")
45-
@DirtiesContext
4644
@DisabledIfDockerUnavailable
4745
@ExtendWith(OutputCaptureExtension.class)
4846
public class TestContainersParallelStartupIntegrationTests {

spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestContainersParallelStartupWithImportTestcontainersIntegrationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
2727
import org.springframework.boot.testcontainers.lifecycle.TestContainersParallelStartupWithImportTestcontainersIntegrationTests.Containers;
2828
import org.springframework.boot.testsupport.testcontainers.DisabledIfDockerUnavailable;
2929
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
30-
import org.springframework.test.annotation.DirtiesContext;
3130
import org.springframework.test.context.TestPropertySource;
3231
import org.springframework.test.context.junit.jupiter.SpringExtension;
3332

@@ -40,7 +39,6 @@
4039
*/
4140
@ExtendWith(SpringExtension.class)
4241
@TestPropertySource(properties = "spring.testcontainers.beans.startup=parallel")
43-
@DirtiesContext
4442
@DisabledIfDockerUnavailable
4543
@ExtendWith(OutputCaptureExtension.class)
4644
@ImportTestcontainers(Containers.class)

spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersImportWithPropertiesInjectedIntoLoadTimeWeaverAwareBeanIntegrationTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.springframework.context.annotation.Bean;
3232
import org.springframework.context.weaving.LoadTimeWeaverAware;
3333
import org.springframework.instrument.classloading.LoadTimeWeaver;
34-
import org.springframework.test.annotation.DirtiesContext;
3534
import org.springframework.test.context.DynamicPropertyRegistry;
3635
import org.springframework.test.context.DynamicPropertySource;
3736
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -40,7 +39,6 @@
4039
* @author Phillip Webb
4140
*/
4241
@ExtendWith(SpringExtension.class)
43-
@DirtiesContext
4442
@DisabledIfDockerUnavailable
4543
@ImportTestcontainers(Containers.class)
4644
class TestcontainersImportWithPropertiesInjectedIntoLoadTimeWeaverAwareBeanIntegrationTests {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
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;
4443
import org.springframework.test.context.TestPropertySource;
4544
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4645

@@ -58,7 +57,6 @@
5857
@TestPropertySource(properties = { "management.otlp.metrics.export.resource-attributes.service.name=test",
5958
"management.otlp.metrics.export.step=1s" })
6059
@Testcontainers(disabledWithoutDocker = true)
61-
@DirtiesContext
6260
class OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests {
6361

6462
private static final String OPENMETRICS_001 = "application/openmetrics-text; version=0.0.1; charset=utf-8";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.test.context.cache.maxSize=1

0 commit comments

Comments
 (0)