From 76e51bc92f08eaacf7812d1b75fc1034f6714042 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Tue, 5 Sep 2023 14:47:39 +0200 Subject: [PATCH] Only enable needed Couchbase services in integration tests --- .../CouchbaseAutoConfigurationIntegrationTests.java | 5 ++++- .../data/couchbase/DataCouchbaseTestIntegrationTests.java | 2 ++ .../DataCouchbaseTestReactiveIntegrationTests.java | 5 ++++- .../DataCouchbaseTestWithIncludeFilterIntegrationTests.java | 6 +++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java index 82ef9350db..5fcd8bb958 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import org.testcontainers.couchbase.BucketDefinition; import org.testcontainers.couchbase.CouchbaseContainer; +import org.testcontainers.couchbase.CouchbaseService; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -51,6 +52,7 @@ class CouchbaseAutoConfigurationIntegrationTests { @Container static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase()) + .withEnabledServices(CouchbaseService.KV) .withCredentials("spring", "password") .withStartupAttempts(5) .withStartupTimeout(Duration.ofMinutes(10)) @@ -60,7 +62,8 @@ class CouchbaseAutoConfigurationIntegrationTests { .withConfiguration(AutoConfigurations.of(CouchbaseAutoConfiguration.class)) .withPropertyValues("spring.couchbase.connection-string: " + couchbase.getConnectionString(), "spring.couchbase.username:spring", "spring.couchbase.password:password", - "spring.couchbase.bucket.name:" + BUCKET_NAME); + "spring.couchbase.bucket.name:" + BUCKET_NAME, "spring.couchbase.env.timeouts.connect=2m", + "spring.couchbase.env.timeouts.key-value=1m"); @Test void defaultConfiguration() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestIntegrationTests.java index fee4f1526f..081f6d4dd6 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestIntegrationTests.java @@ -21,6 +21,7 @@ import java.time.Duration; import org.junit.jupiter.api.Test; import org.testcontainers.couchbase.BucketDefinition; import org.testcontainers.couchbase.CouchbaseContainer; +import org.testcontainers.couchbase.CouchbaseService; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -49,6 +50,7 @@ class DataCouchbaseTestIntegrationTests { @Container static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase()) + .withEnabledServices(CouchbaseService.KV, CouchbaseService.INDEX, CouchbaseService.QUERY) .withStartupAttempts(5) .withStartupTimeout(Duration.ofMinutes(10)) .withBucket(new BucketDefinition(BUCKET_NAME)); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestReactiveIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestReactiveIntegrationTests.java index 27be882a85..99b0e8f546 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestReactiveIntegrationTests.java @@ -21,6 +21,7 @@ import java.time.Duration; import org.junit.jupiter.api.Test; import org.testcontainers.couchbase.BucketDefinition; import org.testcontainers.couchbase.CouchbaseContainer; +import org.testcontainers.couchbase.CouchbaseService; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -38,7 +39,8 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Eddú Meléndez */ -@DataCouchbaseTest +@DataCouchbaseTest( + properties = { "spring.couchbase.env.timeouts.connect=2m", "spring.couchbase.env.timeouts.key-value=1m" }) @Testcontainers(disabledWithoutDocker = true) class DataCouchbaseTestReactiveIntegrationTests { @@ -46,6 +48,7 @@ class DataCouchbaseTestReactiveIntegrationTests { @Container static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase()) + .withEnabledServices(CouchbaseService.KV, CouchbaseService.INDEX, CouchbaseService.QUERY) .withStartupAttempts(5) .withStartupTimeout(Duration.ofMinutes(10)) .withBucket(new BucketDefinition(BUCKET_NAME)); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestWithIncludeFilterIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestWithIncludeFilterIntegrationTests.java index 1e779b709b..75e8de67c6 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestWithIncludeFilterIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/couchbase/DataCouchbaseTestWithIncludeFilterIntegrationTests.java @@ -21,6 +21,7 @@ import java.time.Duration; import org.junit.jupiter.api.Test; import org.testcontainers.couchbase.BucketDefinition; import org.testcontainers.couchbase.CouchbaseContainer; +import org.testcontainers.couchbase.CouchbaseService; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -39,7 +40,9 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Eddú Meléndez */ -@DataCouchbaseTest(includeFilters = @Filter(Service.class)) +@DataCouchbaseTest( + properties = { "spring.couchbase.env.timeouts.connect=2m", "spring.couchbase.env.timeouts.key-value=1m" }, + includeFilters = @Filter(Service.class)) @Testcontainers(disabledWithoutDocker = true) class DataCouchbaseTestWithIncludeFilterIntegrationTests { @@ -47,6 +50,7 @@ class DataCouchbaseTestWithIncludeFilterIntegrationTests { @Container static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase()) + .withEnabledServices(CouchbaseService.KV, CouchbaseService.INDEX, CouchbaseService.QUERY) .withStartupAttempts(5) .withStartupTimeout(Duration.ofMinutes(10)) .withBucket(new BucketDefinition(BUCKET_NAME));