Browse Source

Disable test context cache in spring-boot-testcontainers

Closes gh-41124
pull/42868/head
Andy Wilkinson 2 years ago
parent
commit
138307c13c
  1. 4
      spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestContainersParallelStartupIntegrationTests.java
  2. 4
      spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestContainersParallelStartupWithImportTestcontainersIntegrationTests.java
  3. 2
      spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersImportWithPropertiesInjectedIntoLoadTimeWeaverAwareBeanIntegrationTests.java
  4. 2
      spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/otlp/OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests.java
  5. 1
      spring-boot-project/spring-boot-testcontainers/src/test/resources/spring.properties

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,7 +27,6 @@ import org.springframework.boot.testsupport.testcontainers.DisabledIfDockerUnava @@ -27,7 +27,6 @@ import org.springframework.boot.testsupport.testcontainers.DisabledIfDockerUnava
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = ContainerConfig.class)
@TestPropertySource(properties = "spring.testcontainers.beans.startup=parallel")
@DirtiesContext
@DisabledIfDockerUnavailable
@ExtendWith(OutputCaptureExtension.class)
public class TestContainersParallelStartupIntegrationTests {

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,7 +27,6 @@ import org.springframework.boot.testcontainers.context.ImportTestcontainers; @@ -27,7 +27,6 @@ import org.springframework.boot.testcontainers.context.ImportTestcontainers;
import org.springframework.boot.testcontainers.lifecycle.TestContainersParallelStartupWithImportTestcontainersIntegrationTests.Containers;
import org.springframework.boot.testsupport.testcontainers.DisabledIfDockerUnavailable;
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@ExtendWith(SpringExtension.class)
@TestPropertySource(properties = "spring.testcontainers.beans.startup=parallel")
@DirtiesContext
@DisabledIfDockerUnavailable
@ExtendWith(OutputCaptureExtension.class)
@ImportTestcontainers(Containers.class)

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

@ -31,7 +31,6 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames; @@ -31,7 +31,6 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.context.annotation.Bean;
import org.springframework.context.weaving.LoadTimeWeaverAware;
import org.springframework.instrument.classloading.LoadTimeWeaver;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -40,7 +39,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -40,7 +39,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
* @author Phillip Webb
*/
@ExtendWith(SpringExtension.class)
@DirtiesContext
@DisabledIfDockerUnavailable
@ImportTestcontainers(Containers.class)
class TestcontainersImportWithPropertiesInjectedIntoLoadTimeWeaverAwareBeanIntegrationTests {

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

@ -40,7 +40,6 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect @@ -40,7 +40,6 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
@ -58,7 +57,6 @@ import static org.hamcrest.Matchers.matchesPattern; @@ -58,7 +57,6 @@ import static org.hamcrest.Matchers.matchesPattern;
@TestPropertySource(properties = { "management.otlp.metrics.export.resource-attributes.service.name=test",
"management.otlp.metrics.export.step=1s" })
@Testcontainers(disabledWithoutDocker = true)
@DirtiesContext
class OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests {
private static final String OPENMETRICS_001 = "application/openmetrics-text; version=0.0.1; charset=utf-8";

1
spring-boot-project/spring-boot-testcontainers/src/test/resources/spring.properties

@ -0,0 +1 @@ @@ -0,0 +1 @@
spring.test.context.cache.maxSize=1
Loading…
Cancel
Save