From f9da30faf1a3dccfaffbf8fdac33b8dde354f1a5 Mon Sep 17 00:00:00 2001 From: ThomazPassarelli <113526987+ThomazPassarelli@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:17:43 -0300 Subject: [PATCH 1/2] Replace calls to verifyComplete() to avoid indefinite blocking See gh-35915 --- ...eCloudFoundrySecurityInterceptorTests.java | 14 +++++++------ .../reactive/ReactiveTokenValidatorTests.java | 7 ++++--- ...draDriverReactiveHealthIndicatorTests.java | 21 ++++++++++--------- .../HealthIndicatorReactiveAdapterTests.java | 4 ++-- ...iveHealthIndicatorImplementationTests.java | 8 ++++--- .../r2dbc/ConnectionPoolMetricsTests.java | 7 ++++--- .../MongoReactiveHealthIndicatorTests.java | 6 ++++-- .../Neo4jReactiveHealthIndicatorTests.java | 7 ++++--- ...ConnectionFactoryHealthIndicatorTests.java | 19 +++++++++-------- .../RedisReactiveHealthIndicatorTests.java | 13 ++++++------ .../reactive/HttpTraceWebFilterTests.java | 3 ++- ...dbcRepositoriesAutoConfigurationTests.java | 6 ++++-- ...nsactionManagerAutoConfigurationTests.java | 4 +++- ...DataNeo4jTestReactiveIntegrationTests.java | 4 ++-- .../r2dbc/DataR2dbcTestIntegrationTests.java | 4 +++- ...DataRedisTestReactiveIntegrationTests.java | 7 ++++--- .../netty/NettyRSocketServerFactoryTests.java | 3 ++- .../NettyReactiveWebServerFactoryTests.java | 2 +- .../result/view/MustacheViewTests.java | 2 +- ...AbstractReactiveWebServerFactoryTests.java | 2 +- .../data/r2dbc/CityRepositoryTests.java | 4 +++- .../data/r2dbc/CityRepositoryTests.java | 4 +++- .../SampleRSocketApplicationTests.java | 4 +++- 23 files changed, 91 insertions(+), 64 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java index 46e53f65eb..f6a69c66f1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java @@ -33,6 +33,8 @@ import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; import org.springframework.util.Base64Utils; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @@ -66,7 +68,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { .build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith((response) -> assertThat(response.getStatus()).isEqualTo(HttpStatus.OK)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -75,7 +77,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith( (response) -> assertThat(response.getStatus()).isEqualTo(Reason.MISSING_AUTHORIZATION.getStatus())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -85,7 +87,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith( (response) -> assertThat(response.getStatus()).isEqualTo(Reason.MISSING_AUTHORIZATION.getStatus())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -121,7 +123,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { .build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith((response) -> assertThat(response.getStatus()).isEqualTo(Reason.ACCESS_DENIED.getStatus())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -135,7 +137,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(exchange, "/a")).consumeNextWith((response) -> { assertThat(response.getStatus()).isEqualTo(HttpStatus.OK); assertThat((AccessLevel) exchange.getAttribute("cloudFoundryAccessLevel")).isEqualTo(AccessLevel.FULL); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -151,7 +153,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { assertThat(response.getStatus()).isEqualTo(HttpStatus.OK); assertThat((AccessLevel) exchange.getAttribute("cloudFoundryAccessLevel")) .isEqualTo(AccessLevel.RESTRICTED); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } private String mockAccessToken() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java index 7dcaadc6d7..99e15a283e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java @@ -25,6 +25,7 @@ import java.security.PrivateKey; import java.security.Signature; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; +import java.time.Duration; import java.util.Collections; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -121,7 +122,7 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); assertThat(this.tokenValidator).hasFieldOrPropertyWithValue("cachedTokenKeys", VALID_KEYS); fetchTokenKeys.assertWasSubscribed(); } @@ -135,7 +136,7 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); assertThat(this.tokenValidator).hasFieldOrPropertyWithValue("cachedTokenKeys", VALID_KEYS); fetchTokenKeys.assertWasSubscribed(); } @@ -167,7 +168,7 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); fetchTokenKeys.assertWasNotSubscribed(); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java index 831225ba35..ad8861a2bb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.cassandra; +import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -61,7 +62,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -71,7 +72,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -81,7 +82,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -91,7 +92,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -101,7 +102,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -111,7 +112,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -121,7 +122,7 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -139,7 +140,7 @@ class CassandraDriverReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo(Version.V4_0_0); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -150,7 +151,7 @@ class CassandraDriverReactiveHealthIndicatorTests { StepVerifier.create(health).consumeNextWith((h) -> { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails().get("version")).isNull(); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -165,7 +166,7 @@ class CassandraDriverReactiveHealthIndicatorTests { assertThat(h.getDetails()).containsOnlyKeys("error"); assertThat(h.getDetails().get("error")) .isEqualTo(DriverTimeoutException.class.getName() + ": Test Exception"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } private CqlSession mockCqlSessionWithNodeState(NodeState... nodeStates) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java index bfb32465cb..e6304419d4 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java @@ -37,7 +37,7 @@ class HealthIndicatorReactiveAdapterTests { HealthIndicatorReactiveAdapter adapter = new HealthIndicatorReactiveAdapter(delegate); Health status = Health.up().build(); given(delegate.health()).willReturn(status); - StepVerifier.create(adapter.health()).expectNext(status).verifyComplete(); + StepVerifier.create(adapter.health()).expectNext(status).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -55,7 +55,7 @@ class HealthIndicatorReactiveAdapterTests { .status(Thread.currentThread().getName().equals(currentThread) ? Status.DOWN : Status.UP) .build(); HealthIndicatorReactiveAdapter adapter = new HealthIndicatorReactiveAdapter(delegate); - StepVerifier.create(adapter.health()).expectNext(Health.status(Status.UP).build()).verifyComplete(); + StepVerifier.create(adapter.health()).expectNext(Health.status(Status.UP).build()).expectComplete().verify(Duration.ofSeconds(5)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java index f9f715514f..a2e2988dbf 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java @@ -25,6 +25,8 @@ import org.springframework.boot.actuate.health.Health.Builder; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -40,7 +42,7 @@ class ReactiveHealthIndicatorImplementationTests { void healthUp(CapturedOutput output) { StepVerifier.create(new SimpleReactiveHealthIndicator().health()) .consumeNextWith((health) -> assertThat(health).isEqualTo(Health.up().build())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); assertThat(output).doesNotContain("Health check failed for simple"); } @@ -49,7 +51,7 @@ class ReactiveHealthIndicatorImplementationTests { StepVerifier.create(new CustomErrorMessageReactiveHealthIndicator().health()) .consumeNextWith( (health) -> assertThat(health).isEqualTo(Health.down(new UnsupportedOperationException()).build())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); assertThat(output).contains("Health check failed for custom"); } @@ -57,7 +59,7 @@ class ReactiveHealthIndicatorImplementationTests { void healthDownWithCustomErrorMessageFunction(CapturedOutput output) { StepVerifier.create(new CustomErrorMessageFunctionReactiveHealthIndicator().health()) .consumeNextWith((health) -> assertThat(health).isEqualTo(Health.down(new RuntimeException()).build())) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); assertThat(output).contains("Health check failed with RuntimeException"); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java index e41e18eb3f..3b65a6d3cc 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.metrics.r2dbc; +import java.time.Duration; import java.util.Collections; import java.util.UUID; @@ -59,7 +60,7 @@ class ConnectionPoolMetricsTests { @AfterEach void close() { if (this.connectionFactory != null) { - StepVerifier.create(this.connectionFactory.close()).verifyComplete(); + StepVerifier.create(this.connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); } } @@ -72,8 +73,8 @@ class ConnectionPoolMetricsTests { Tags.of(testTag, regionTag)); metrics.bindTo(registry); // acquire two connections - connectionPool.create().as(StepVerifier::create).expectNextCount(1).verifyComplete(); - connectionPool.create().as(StepVerifier::create).expectNextCount(1).verifyComplete(); + connectionPool.create().as(StepVerifier::create).expectNextCount(1).expectComplete().verify(Duration.ofSeconds(5)); + connectionPool.create().as(StepVerifier::create).expectNextCount(1).expectComplete().verify(Duration.ofSeconds(5)); assertGauge(registry, "r2dbc.pool.acquired", 2); assertGauge(registry, "r2dbc.pool.allocated", 3); assertGauge(registry, "r2dbc.pool.idle", 1); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java index 9b1e549d02..f2bdfd88f1 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java @@ -26,6 +26,8 @@ import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Status; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -50,7 +52,7 @@ class MongoReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo("2.6.4"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -65,7 +67,7 @@ class MongoReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.DOWN); assertThat(h.getDetails()).containsOnlyKeys("error"); assertThat(h.getDetails().get("error")).isEqualTo(MongoException.class.getName() + ": Connection failed"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java index 01104dbc8d..0052b94bdb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.neo4j; +import java.time.Duration; import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.Test; @@ -58,7 +59,7 @@ class Neo4jReactiveHealthIndicatorTests { assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).containsEntry("server", "4711@My Home"); assertThat(health.getDetails()).containsEntry("edition", "ultimate collectors edition"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -80,7 +81,7 @@ class Neo4jReactiveHealthIndicatorTests { assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).containsEntry("server", "4711@My Home"); assertThat(health.getDetails()).containsEntry("edition", "some edition"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); then(session).should(times(2)).close(); } @@ -92,7 +93,7 @@ class Neo4jReactiveHealthIndicatorTests { healthIndicator.health().as(StepVerifier::create).consumeNextWith((health) -> { assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()).containsKeys("error"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } private RxResult mockStatementResult(ResultSummary resultSummary, String version, String edition) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java index 2f57add1bb..61958e1a9d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.r2dbc; +import java.time.Duration; import java.util.Collections; import java.util.UUID; @@ -56,10 +57,10 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.UP); assertThat(actual.getDetails()).containsOnly(entry("database", "H2"), entry("validationQuery", "validate(REMOTE)")); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } finally { - StepVerifier.create(connectionFactory.close()).verifyComplete(); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); } } @@ -74,7 +75,7 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.DOWN); assertThat(actual.getDetails()).containsOnly(entry("database", "mock"), entry("validationQuery", "validate(REMOTE)"), entry("error", "java.lang.RuntimeException: test")); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -90,7 +91,7 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.DOWN); assertThat(actual.getDetails()).containsOnly(entry("database", "mock"), entry("validationQuery", "validate(REMOTE)")); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -104,17 +105,17 @@ class ConnectionFactoryHealthIndicatorTests { .flatMap(Result::getRowsUpdated) .thenMany(it.close())) .as(StepVerifier::create) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); ReactiveHealthIndicator healthIndicator = new ConnectionFactoryHealthIndicator(connectionFactory, customValidationQuery); healthIndicator.health().as(StepVerifier::create).assertNext((actual) -> { assertThat(actual.getStatus()).isEqualTo(Status.UP); assertThat(actual.getDetails()).containsOnly(entry("database", "H2"), entry("result", 0L), entry("validationQuery", customValidationQuery)); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } finally { - StepVerifier.create(connectionFactory.close()).verifyComplete(); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); } } @@ -131,10 +132,10 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getDetails()).contains(entry("database", "H2"), entry("validationQuery", invalidValidationQuery)); assertThat(actual.getDetails()).containsOnlyKeys("database", "error", "validationQuery"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } finally { - StepVerifier.create(connectionFactory.close()).verifyComplete(); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java index e28aed8a65..c0a238e4fc 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.redis; +import java.time.Duration; import java.util.Properties; import io.lettuce.core.RedisConnectionException; @@ -62,7 +63,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo("2.8.9"); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); then(redisConnection).should().closeLater(); } @@ -76,7 +77,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getDetails().get("cluster_size")).isEqualTo(4L); assertThat(h.getDetails().get("slots_up")).isEqualTo(4L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(0L); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); then(redisConnectionFactory.getReactiveConnection()).should().closeLater(); } @@ -90,7 +91,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getDetails().get("cluster_size")).isEqualTo(4L); assertThat(h.getDetails().get("slots_up")).isEqualTo(4L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(0L); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -102,7 +103,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.DOWN); assertThat(h.getDetails().get("slots_up")).isEqualTo(3L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(1L); - }).verifyComplete(); + }).expectComplete().verify(Duration.ofSeconds(5)); } @Test @@ -115,7 +116,7 @@ class RedisReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); then(redisConnection).should().closeLater(); } @@ -128,7 +129,7 @@ class RedisReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } private RedisReactiveHealthIndicator createHealthIndicator(ReactiveRedisConnection redisConnection, diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java index e9c1065809..3e2eb2c636 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.trace.http.reactive; import java.security.Principal; +import java.time.Duration; import java.util.EnumSet; import org.junit.jupiter.api.Test; @@ -105,7 +106,7 @@ class HttpTraceWebFilterTests { private void executeFilter(ServerWebExchange exchange, WebFilterChain chain) { StepVerifier .create(this.filter.filter(exchange, chain).then(Mono.defer(() -> exchange.getResponse().setComplete()))) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java index 05e25361de..9768cee576 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java @@ -39,6 +39,8 @@ import org.springframework.data.repository.Repository; import org.springframework.r2dbc.connection.init.ResourceDatabasePopulator; import org.springframework.r2dbc.core.DatabaseClient; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -80,7 +82,7 @@ class R2dbcRepositoriesAutoConfigurationTests { .findById(2000L) .as(StepVerifier::create) .expectNextCount(1) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); }); } @@ -103,7 +105,7 @@ class R2dbcRepositoriesAutoConfigurationTests { .findById(2000L) .as(StepVerifier::create) .expectNextCount(1) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java index 379a1b6e67..4d2f5488be 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java @@ -33,6 +33,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.reactive.TransactionSynchronizationManager; import org.springframework.transaction.reactive.TransactionalOperator; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -65,7 +67,7 @@ class R2dbcTransactionManagerAutoConfigurationTests { this.contextRunner.withUserConfiguration(SingleConnectionFactoryConfiguration.class, BaseConfiguration.class) .run((context) -> { TransactionalService bean = context.getBean(TransactionalService.class); - bean.isTransactionActive().as(StepVerifier::create).expectNext(true).verifyComplete(); + bean.isTransactionActive().as(StepVerifier::create).expectNext(true).expectComplete().verify(Duration.ofSeconds(5)); }); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java index 5ac5106ae1..bdfab93c29 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java @@ -83,8 +83,8 @@ class DataNeo4jTestReactiveIntegrationTests { .flatMap(this.exampleRepository::save) .as(StepVerifier::create) .expectNextCount(1) - .verifyComplete(); - StepVerifier.create(this.neo4jTemplate.count(ExampleGraph.class)).expectNext(1L).verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(this.neo4jTemplate.count(ExampleGraph.class)).expectNext(1L).expectComplete().verify(Duration.ofSeconds(5)); } @Test diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java index 2a6d9f9aed..81de03682c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java @@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.r2dbc.core.DatabaseClient; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -46,7 +48,7 @@ class DataR2dbcTestIntegrationTests { @Test void testDatabaseClient() { - this.databaseClient.sql("SELECT * FROM example").fetch().all().as(StepVerifier::create).verifyComplete(); + this.databaseClient.sql("SELECT * FROM example").fetch().all().as(StepVerifier::create).expectComplete().verify(Duration.ofSeconds(5)); } @Test diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java index bef8277190..4aadbb0240 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.test.autoconfigure.data.redis; +import java.time.Duration; import java.util.UUID; import org.junit.jupiter.api.Test; @@ -62,11 +63,11 @@ class DataRedisTestReactiveIntegrationTests { String id = UUID.randomUUID().toString(); StepVerifier.create(this.operations.opsForValue().set(id, "Hello World")) .expectNext(Boolean.TRUE) - .verifyComplete(); - StepVerifier.create(this.operations.opsForValue().get(id)).expectNext("Hello World").verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(this.operations.opsForValue().get(id)).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); StepVerifier.create(this.operations.execute((action) -> action.serverCommands().flushDb())) .expectNext("OK") - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java index dfdf965fff..0dfbf17e43 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java @@ -18,6 +18,7 @@ package org.springframework.boot.rsocket.netty; import java.net.InetSocketAddress; import java.nio.channels.ClosedChannelException; +import java.time.Duration; import java.util.Arrays; import java.util.concurrent.Callable; @@ -194,7 +195,7 @@ class NettyRSocketServerFactoryTests { private void checkEchoRequest() { String payload = "test payload"; Mono response = this.requester.route("test").data(payload).retrieveMono(String.class); - StepVerifier.create(response).expectNext(payload).verifyComplete(); + StepVerifier.create(response).expectNext(payload).expectComplete().verify(Duration.ofSeconds(5)); } private void testBasicSslWithKeyStore(String keyStore, String keyPassword, Transport transport) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java index 983317ccf6..2c58ec77dc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java @@ -110,7 +110,7 @@ class NettyReactiveWebServerFactoryTests extends AbstractReactiveWebServerFactor void whenSslIsConfiguredWithAValidAliasARequestSucceeds() { Mono result = testSslWithAlias("test-alias"); StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - StepVerifier.create(result).expectNext("Hello World").verifyComplete(); + StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java index b4add7efcf..2d845d1ce4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java @@ -55,7 +55,7 @@ class MustacheViewTests { .block(Duration.ofSeconds(30)); StepVerifier.create(exchange.getResponse().getBodyAsString()) .assertNext((body) -> assertThat(body).isEqualToIgnoringWhitespace("Hello Spring")) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index 5e0d79b1ff..e1c90bb833 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -194,7 +194,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { .bodyToMono(String.class); StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - StepVerifier.create(result).expectNext("Hello World").verifyComplete(); + StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); } @Test diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java index 9c082c3f3b..8a1cf8c524 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java @@ -28,6 +28,8 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -60,7 +62,7 @@ class CityRepositoryTests { void databaseHasBeenInitialized() { StepVerifier.create(this.repository.findByState("DC").filter((city) -> city.getName().equals("Washington"))) .consumeNextWith((city) -> assertThat(city.getId()).isNotNull()) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } private static String r2dbcUrl() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java index c0de6abc3f..16e293d666 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java @@ -28,6 +28,8 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -60,7 +62,7 @@ class CityRepositoryTests { void databaseHasBeenInitialized() { StepVerifier.create(this.repository.findByState("DC").filter((city) -> city.getName().equals("Washington"))) .consumeNextWith((city) -> assertThat(city.getId()).isNotNull()) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } private static String r2dbcUrl() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java index 61a85d4801..45cc86b72f 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java @@ -30,6 +30,8 @@ import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.util.MimeTypeUtils; +import java.time.Duration; + @SpringBootTest(properties = "spring.rsocket.server.port=0") class SampleRSocketApplicationTests { @@ -56,7 +58,7 @@ class SampleRSocketApplicationTests { Mono result = requester.route("find.project.spring-boot").retrieveMono(Project.class); StepVerifier.create(result) .assertNext((project) -> Assertions.assertThat(project.getName()).isEqualTo("spring-boot")) - .verifyComplete(); + .expectComplete().verify(Duration.ofSeconds(5)); } } From d2966e1cbff5a120c3b7b48865758fbc8091db4c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 23 Jun 2023 12:17:07 +0100 Subject: [PATCH 2/2] Polish "Replace calls to verifyComplete() to avoid indefinite blocking" See gh-35915 --- .../build/architecture/ArchitectureCheck.java | 18 ++++++++++++- ...eCloudFoundrySecurityInterceptorTests.java | 20 ++++++++------ .../reactive/ReactiveTokenValidatorTests.java | 9 ++++--- ...draDriverReactiveHealthIndicatorTests.java | 27 ++++++++++++------- .../HealthIndicatorReactiveAdapterTests.java | 7 +++-- ...iveHealthIndicatorImplementationTests.java | 13 +++++---- .../r2dbc/ConnectionPoolMetricsTests.java | 16 ++++++++--- .../server/MetricsWebFilterTests.java | 2 +- .../MongoReactiveHealthIndicatorTests.java | 8 +++--- .../Neo4jReactiveHealthIndicatorTests.java | 8 +++--- ...ConnectionFactoryHealthIndicatorTests.java | 19 ++++++------- .../RedisReactiveHealthIndicatorTests.java | 14 +++++----- .../reactive/HttpTraceWebFilterTests.java | 3 ++- ...dbcRepositoriesAutoConfigurationTests.java | 10 ++++--- ...nsactionManagerAutoConfigurationTests.java | 10 ++++--- ...DataNeo4jTestReactiveIntegrationTests.java | 8 ++++-- .../r2dbc/DataR2dbcTestIntegrationTests.java | 13 ++++++--- ...DataRedisTestReactiveIntegrationTests.java | 11 +++++--- .../netty/NettyRSocketServerFactoryTests.java | 2 +- .../NettyReactiveWebServerFactoryTests.java | 3 +-- .../result/view/MustacheViewTests.java | 3 ++- ...AbstractReactiveWebServerFactoryTests.java | 3 +-- .../data/r2dbc/CityRepositoryTests.java | 7 ++--- .../data/r2dbc/CityRepositoryTests.java | 7 ++--- .../SampleRSocketApplicationTests.java | 7 ++--- 25 files changed, 159 insertions(+), 89 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java index e6dba8e5cf..34335360f2 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java @@ -74,7 +74,9 @@ public abstract class ArchitectureCheck extends DefaultTask { .importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList())); List violations = Stream.of(allPackagesShouldBeFreeOfTangles(), allBeanPostProcessorBeanMethodsShouldBeStaticAndHaveParametersThatWillNotCausePrematureInitialization(), - allBeanFactoryPostProcessorBeanMethodsShouldBeStaticAndHaveNoParameters()) + allBeanFactoryPostProcessorBeanMethodsShouldBeStaticAndHaveNoParameters(), + noClassesShouldCallStepVerifierStepVerifyComplete(), + noClassesShouldConfigureDefaultStepVerifierTimeout()) .map((rule) -> rule.evaluate(javaClasses)) .filter(EvaluationResult::hasViolation) .collect(Collectors.toList()); @@ -163,6 +165,20 @@ public abstract class ArchitectureCheck extends DefaultTask { }; } + private ArchRule noClassesShouldCallStepVerifierStepVerifyComplete() { + return ArchRuleDefinition.noClasses() + .should() + .callMethod("reactor.test.StepVerifier$Step", "verifyComplete") + .because("it can block indefinitely and expectComplete().verify(Duration) should be used instead"); + } + + private ArchRule noClassesShouldConfigureDefaultStepVerifierTimeout() { + return ArchRuleDefinition.noClasses() + .should() + .callMethod("reactor.test.StepVerifier", "setDefaultTimeout", "java.time.Duration") + .because("expectComplete().verify(Duration) should be used instead"); + } + public void setClasses(FileCollection classes) { this.classes = classes; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java index f6a69c66f1..2af2f8dc7a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive; +import java.time.Duration; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -33,8 +35,6 @@ import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; import org.springframework.util.Base64Utils; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @@ -68,7 +68,8 @@ class ReactiveCloudFoundrySecurityInterceptorTests { .build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith((response) -> assertThat(response.getStatus()).isEqualTo(HttpStatus.OK)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -77,7 +78,8 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith( (response) -> assertThat(response.getStatus()).isEqualTo(Reason.MISSING_AUTHORIZATION.getStatus())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -87,7 +89,8 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith( (response) -> assertThat(response.getStatus()).isEqualTo(Reason.MISSING_AUTHORIZATION.getStatus())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -123,7 +126,8 @@ class ReactiveCloudFoundrySecurityInterceptorTests { .build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) .consumeNextWith((response) -> assertThat(response.getStatus()).isEqualTo(Reason.ACCESS_DENIED.getStatus())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -137,7 +141,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { StepVerifier.create(this.interceptor.preHandle(exchange, "/a")).consumeNextWith((response) -> { assertThat(response.getStatus()).isEqualTo(HttpStatus.OK); assertThat((AccessLevel) exchange.getAttribute("cloudFoundryAccessLevel")).isEqualTo(AccessLevel.FULL); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -153,7 +157,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests { assertThat(response.getStatus()).isEqualTo(HttpStatus.OK); assertThat((AccessLevel) exchange.getAttribute("cloudFoundryAccessLevel")) .isEqualTo(AccessLevel.RESTRICTED); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } private String mockAccessToken() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java index 99e15a283e..5828d9c3c5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java @@ -122,7 +122,8 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); assertThat(this.tokenValidator).hasFieldOrPropertyWithValue("cachedTokenKeys", VALID_KEYS); fetchTokenKeys.assertWasSubscribed(); } @@ -136,7 +137,8 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); assertThat(this.tokenValidator).hasFieldOrPropertyWithValue("cachedTokenKeys", VALID_KEYS); fetchTokenKeys.assertWasSubscribed(); } @@ -168,7 +170,8 @@ class ReactiveTokenValidatorTests { String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; StepVerifier .create(this.tokenValidator.validate(new Token(getSignedToken(header.getBytes(), claims.getBytes())))) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); fetchTokenKeys.assertWasNotSubscribed(); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java index ad8861a2bb..366de2fd07 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraDriverReactiveHealthIndicatorTests.java @@ -62,7 +62,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -72,7 +73,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -82,7 +84,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -92,7 +95,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -102,7 +106,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -112,7 +117,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -122,7 +128,8 @@ class CassandraDriverReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test @@ -140,7 +147,7 @@ class CassandraDriverReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo(Version.V4_0_0); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -151,7 +158,7 @@ class CassandraDriverReactiveHealthIndicatorTests { StepVerifier.create(health).consumeNextWith((h) -> { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails().get("version")).isNull(); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -166,7 +173,7 @@ class CassandraDriverReactiveHealthIndicatorTests { assertThat(h.getDetails()).containsOnlyKeys("error"); assertThat(h.getDetails().get("error")) .isEqualTo(DriverTimeoutException.class.getName() + ": Test Exception"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } private CqlSession mockCqlSessionWithNodeState(NodeState... nodeStates) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java index e6304419d4..5ed07cda1d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java @@ -37,7 +37,7 @@ class HealthIndicatorReactiveAdapterTests { HealthIndicatorReactiveAdapter adapter = new HealthIndicatorReactiveAdapter(delegate); Health status = Health.up().build(); given(delegate.health()).willReturn(status); - StepVerifier.create(adapter.health()).expectNext(status).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(adapter.health()).expectNext(status).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -55,7 +55,10 @@ class HealthIndicatorReactiveAdapterTests { .status(Thread.currentThread().getName().equals(currentThread) ? Status.DOWN : Status.UP) .build(); HealthIndicatorReactiveAdapter adapter = new HealthIndicatorReactiveAdapter(delegate); - StepVerifier.create(adapter.health()).expectNext(Health.status(Status.UP).build()).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(adapter.health()) + .expectNext(Health.status(Status.UP).build()) + .expectComplete() + .verify(Duration.ofSeconds(30)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java index a2e2988dbf..042b5bed22 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorImplementationTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.health; +import java.time.Duration; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; @@ -25,8 +27,6 @@ import org.springframework.boot.actuate.health.Health.Builder; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -42,7 +42,8 @@ class ReactiveHealthIndicatorImplementationTests { void healthUp(CapturedOutput output) { StepVerifier.create(new SimpleReactiveHealthIndicator().health()) .consumeNextWith((health) -> assertThat(health).isEqualTo(Health.up().build())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); assertThat(output).doesNotContain("Health check failed for simple"); } @@ -51,7 +52,8 @@ class ReactiveHealthIndicatorImplementationTests { StepVerifier.create(new CustomErrorMessageReactiveHealthIndicator().health()) .consumeNextWith( (health) -> assertThat(health).isEqualTo(Health.down(new UnsupportedOperationException()).build())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); assertThat(output).contains("Health check failed for custom"); } @@ -59,7 +61,8 @@ class ReactiveHealthIndicatorImplementationTests { void healthDownWithCustomErrorMessageFunction(CapturedOutput output) { StepVerifier.create(new CustomErrorMessageFunctionReactiveHealthIndicator().health()) .consumeNextWith((health) -> assertThat(health).isEqualTo(Health.down(new RuntimeException()).build())) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); assertThat(output).contains("Health check failed with RuntimeException"); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java index 3b65a6d3cc..bb0f1055ca 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/r2dbc/ConnectionPoolMetricsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2023 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. @@ -60,7 +60,7 @@ class ConnectionPoolMetricsTests { @AfterEach void close() { if (this.connectionFactory != null) { - StepVerifier.create(this.connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(this.connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(30)); } } @@ -73,8 +73,16 @@ class ConnectionPoolMetricsTests { Tags.of(testTag, regionTag)); metrics.bindTo(registry); // acquire two connections - connectionPool.create().as(StepVerifier::create).expectNextCount(1).expectComplete().verify(Duration.ofSeconds(5)); - connectionPool.create().as(StepVerifier::create).expectNextCount(1).expectComplete().verify(Duration.ofSeconds(5)); + connectionPool.create() + .as(StepVerifier::create) + .expectNextCount(1) + .expectComplete() + .verify(Duration.ofSeconds(30)); + connectionPool.create() + .as(StepVerifier::create) + .expectNextCount(1) + .expectComplete() + .verify(Duration.ofSeconds(30)); assertGauge(registry, "r2dbc.pool.acquired", 2); assertGauge(registry, "r2dbc.pool.allocated", 3); assertGauge(registry, "r2dbc.pool.idle", 1); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java index f4bae33486..408bb57f73 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java @@ -162,7 +162,7 @@ class MetricsWebFilterTests { exchange.getResponse().setRawStatusCode(500); return exchange.getResponse().setComplete(); }); - StepVerifier.create(processing).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(processing).expectComplete().verify(Duration.ofSeconds(30)); assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("status", "500"); assertMetricsContainsTag("outcome", "UNKNOWN"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java index f2bdfd88f1..d153fdc763 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicatorTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.mongo; +import java.time.Duration; + import com.mongodb.MongoException; import org.bson.Document; import org.junit.jupiter.api.Test; @@ -26,8 +28,6 @@ import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Status; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -52,7 +52,7 @@ class MongoReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo("2.6.4"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -67,7 +67,7 @@ class MongoReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.DOWN); assertThat(h.getDetails()).containsOnlyKeys("error"); assertThat(h.getDetails().get("error")).isEqualTo(MongoException.class.getName() + ": Connection failed"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java index 0052b94bdb..6610ac216f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jReactiveHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 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. @@ -59,7 +59,7 @@ class Neo4jReactiveHealthIndicatorTests { assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).containsEntry("server", "4711@My Home"); assertThat(health.getDetails()).containsEntry("edition", "ultimate collectors edition"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -81,7 +81,7 @@ class Neo4jReactiveHealthIndicatorTests { assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).containsEntry("server", "4711@My Home"); assertThat(health.getDetails()).containsEntry("edition", "some edition"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); then(session).should(times(2)).close(); } @@ -93,7 +93,7 @@ class Neo4jReactiveHealthIndicatorTests { healthIndicator.health().as(StepVerifier::create).consumeNextWith((health) -> { assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()).containsKeys("error"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } private RxResult mockStatementResult(ResultSummary resultSummary, String version, String edition) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java index 61958e1a9d..1da4777744 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/r2dbc/ConnectionFactoryHealthIndicatorTests.java @@ -57,10 +57,10 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.UP); assertThat(actual.getDetails()).containsOnly(entry("database", "H2"), entry("validationQuery", "validate(REMOTE)")); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } finally { - StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(30)); } } @@ -75,7 +75,7 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.DOWN); assertThat(actual.getDetails()).containsOnly(entry("database", "mock"), entry("validationQuery", "validate(REMOTE)"), entry("error", "java.lang.RuntimeException: test")); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -91,7 +91,7 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getStatus()).isEqualTo(Status.DOWN); assertThat(actual.getDetails()).containsOnly(entry("database", "mock"), entry("validationQuery", "validate(REMOTE)")); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -105,17 +105,18 @@ class ConnectionFactoryHealthIndicatorTests { .flatMap(Result::getRowsUpdated) .thenMany(it.close())) .as(StepVerifier::create) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); ReactiveHealthIndicator healthIndicator = new ConnectionFactoryHealthIndicator(connectionFactory, customValidationQuery); healthIndicator.health().as(StepVerifier::create).assertNext((actual) -> { assertThat(actual.getStatus()).isEqualTo(Status.UP); assertThat(actual.getDetails()).containsOnly(entry("database", "H2"), entry("result", 0L), entry("validationQuery", customValidationQuery)); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } finally { - StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(30)); } } @@ -132,10 +133,10 @@ class ConnectionFactoryHealthIndicatorTests { assertThat(actual.getDetails()).contains(entry("database", "H2"), entry("validationQuery", invalidValidationQuery)); assertThat(actual.getDetails()).containsOnlyKeys("database", "error", "validationQuery"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } finally { - StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(connectionFactory.close()).expectComplete().verify(Duration.ofSeconds(30)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java index c0a238e4fc..d8850a7464 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java @@ -63,7 +63,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getDetails()).containsOnlyKeys("version"); assertThat(h.getDetails().get("version")).isEqualTo("2.8.9"); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); then(redisConnection).should().closeLater(); } @@ -77,7 +77,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getDetails().get("cluster_size")).isEqualTo(4L); assertThat(h.getDetails().get("slots_up")).isEqualTo(4L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(0L); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); then(redisConnectionFactory.getReactiveConnection()).should().closeLater(); } @@ -91,7 +91,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getDetails().get("cluster_size")).isEqualTo(4L); assertThat(h.getDetails().get("slots_up")).isEqualTo(4L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(0L); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -103,7 +103,7 @@ class RedisReactiveHealthIndicatorTests { assertThat(h.getStatus()).isEqualTo(Status.DOWN); assertThat(h.getDetails().get("slots_up")).isEqualTo(3L); assertThat(h.getDetails().get("slots_fail")).isEqualTo(1L); - }).expectComplete().verify(Duration.ofSeconds(5)); + }).expectComplete().verify(Duration.ofSeconds(30)); } @Test @@ -116,7 +116,8 @@ class RedisReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); then(redisConnection).should().closeLater(); } @@ -129,7 +130,8 @@ class RedisReactiveHealthIndicatorTests { Mono health = healthIndicator.health(); StepVerifier.create(health) .consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } private RedisReactiveHealthIndicator createHealthIndicator(ReactiveRedisConnection redisConnection, diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java index 3e2eb2c636..d2218cc3e0 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/http/reactive/HttpTraceWebFilterTests.java @@ -106,7 +106,8 @@ class HttpTraceWebFilterTests { private void executeFilter(ServerWebExchange exchange, WebFilterChain chain) { StepVerifier .create(this.filter.filter(exchange, chain).then(Mono.defer(() -> exchange.getResponse().setComplete()))) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java index 9768cee576..b9bea3baf0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesAutoConfigurationTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.autoconfigure.data.r2dbc; +import java.time.Duration; + import io.r2dbc.spi.ConnectionFactory; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -39,8 +41,6 @@ import org.springframework.data.repository.Repository; import org.springframework.r2dbc.connection.init.ResourceDatabasePopulator; import org.springframework.r2dbc.core.DatabaseClient; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -82,7 +82,8 @@ class R2dbcRepositoriesAutoConfigurationTests { .findById(2000L) .as(StepVerifier::create) .expectNextCount(1) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); }); } @@ -105,7 +106,8 @@ class R2dbcRepositoriesAutoConfigurationTests { .findById(2000L) .as(StepVerifier::create) .expectNextCount(1) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java index 4d2f5488be..b62599ecff 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcTransactionManagerAutoConfigurationTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.autoconfigure.r2dbc; +import java.time.Duration; + import io.r2dbc.spi.Connection; import io.r2dbc.spi.ConnectionFactory; import org.junit.jupiter.api.Test; @@ -33,8 +35,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.reactive.TransactionSynchronizationManager; import org.springframework.transaction.reactive.TransactionalOperator; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -67,7 +67,11 @@ class R2dbcTransactionManagerAutoConfigurationTests { this.contextRunner.withUserConfiguration(SingleConnectionFactoryConfiguration.class, BaseConfiguration.class) .run((context) -> { TransactionalService bean = context.getBean(TransactionalService.class); - bean.isTransactionActive().as(StepVerifier::create).expectNext(true).expectComplete().verify(Duration.ofSeconds(5)); + bean.isTransactionActive() + .as(StepVerifier::create) + .expectNext(true) + .expectComplete() + .verify(Duration.ofSeconds(30)); }); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java index bdfab93c29..1be6499814 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestReactiveIntegrationTests.java @@ -83,8 +83,12 @@ class DataNeo4jTestReactiveIntegrationTests { .flatMap(this.exampleRepository::save) .as(StepVerifier::create) .expectNextCount(1) - .expectComplete().verify(Duration.ofSeconds(5)); - StepVerifier.create(this.neo4jTemplate.count(ExampleGraph.class)).expectNext(1L).expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); + StepVerifier.create(this.neo4jTemplate.count(ExampleGraph.class)) + .expectNext(1L) + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java index 81de03682c..535c1a4732 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/r2dbc/DataR2dbcTestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2023 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. @@ -16,6 +16,8 @@ package org.springframework.boot.test.autoconfigure.data.r2dbc; +import java.time.Duration; + import io.r2dbc.spi.ConnectionFactory; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -24,8 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.r2dbc.core.DatabaseClient; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -48,7 +48,12 @@ class DataR2dbcTestIntegrationTests { @Test void testDatabaseClient() { - this.databaseClient.sql("SELECT * FROM example").fetch().all().as(StepVerifier::create).expectComplete().verify(Duration.ofSeconds(5)); + this.databaseClient.sql("SELECT * FROM example") + .fetch() + .all() + .as(StepVerifier::create) + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java index 4aadbb0240..af24c91076 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestReactiveIntegrationTests.java @@ -63,11 +63,16 @@ class DataRedisTestReactiveIntegrationTests { String id = UUID.randomUUID().toString(); StepVerifier.create(this.operations.opsForValue().set(id, "Hello World")) .expectNext(Boolean.TRUE) - .expectComplete().verify(Duration.ofSeconds(5)); - StepVerifier.create(this.operations.opsForValue().get(id)).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); + StepVerifier.create(this.operations.opsForValue().get(id)) + .expectNext("Hello World") + .expectComplete() + .verify(Duration.ofSeconds(30)); StepVerifier.create(this.operations.execute((action) -> action.serverCommands().flushDb())) .expectNext("OK") - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java index 0dfbf17e43..6a918d594b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java @@ -195,7 +195,7 @@ class NettyRSocketServerFactoryTests { private void checkEchoRequest() { String payload = "test payload"; Mono response = this.requester.route("test").data(payload).retrieveMono(String.class); - StepVerifier.create(response).expectNext(payload).expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(response).expectNext(payload).expectComplete().verify(Duration.ofSeconds(30)); } private void testBasicSslWithKeyStore(String keyStore, String keyPassword, Transport transport) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java index 2c58ec77dc..61f123b74b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java @@ -109,8 +109,7 @@ class NettyReactiveWebServerFactoryTests extends AbstractReactiveWebServerFactor @Test void whenSslIsConfiguredWithAValidAliasARequestSucceeds() { Mono result = testSslWithAlias("test-alias"); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(30)); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java index 2d845d1ce4..2431bf79bc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java @@ -55,7 +55,8 @@ class MustacheViewTests { .block(Duration.ofSeconds(30)); StepVerifier.create(exchange.getResponse().getBodyAsString()) .assertNext((body) -> assertThat(body).isEqualToIgnoringWhitespace("Hello Spring")) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index e1c90bb833..78bc32463c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -193,8 +193,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { .retrieve() .bodyToMono(String.class); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(5)); + StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(30)); } @Test diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java index 8a1cf8c524..4d551e6777 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-flyway/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java @@ -16,6 +16,8 @@ package smoketest.data.r2dbc; +import java.time.Duration; + import org.junit.jupiter.api.Test; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.junit.jupiter.Container; @@ -28,8 +30,6 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -62,7 +62,8 @@ class CityRepositoryTests { void databaseHasBeenInitialized() { StepVerifier.create(this.repository.findByState("DC").filter((city) -> city.getName().equals("Washington"))) .consumeNextWith((city) -> assertThat(city.getId()).isNotNull()) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } private static String r2dbcUrl() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java index 16e293d666..2b470570c3 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-r2dbc-liquibase/src/test/java/smoketest/data/r2dbc/CityRepositoryTests.java @@ -16,6 +16,8 @@ package smoketest.data.r2dbc; +import java.time.Duration; + import org.junit.jupiter.api.Test; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.junit.jupiter.Container; @@ -28,8 +30,6 @@ import org.springframework.boot.testsupport.testcontainers.DockerImageNames; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; -import java.time.Duration; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -62,7 +62,8 @@ class CityRepositoryTests { void databaseHasBeenInitialized() { StepVerifier.create(this.repository.findByState("DC").filter((city) -> city.getName().equals("Washington"))) .consumeNextWith((city) -> assertThat(city.getId()).isNotNull()) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } private static String r2dbcUrl() { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java index 45cc86b72f..0a6f807249 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java @@ -16,6 +16,8 @@ package smoketest.rsocket; +import java.time.Duration; + import io.rsocket.metadata.WellKnownMimeType; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -30,8 +32,6 @@ import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.util.MimeTypeUtils; -import java.time.Duration; - @SpringBootTest(properties = "spring.rsocket.server.port=0") class SampleRSocketApplicationTests { @@ -58,7 +58,8 @@ class SampleRSocketApplicationTests { Mono result = requester.route("find.project.spring-boot").retrieveMono(Project.class); StepVerifier.create(result) .assertNext((project) -> Assertions.assertThat(project.getName()).isEqualTo("spring-boot")) - .expectComplete().verify(Duration.ofSeconds(5)); + .expectComplete() + .verify(Duration.ofSeconds(30)); } }