Replace calls to verifyComplete() to avoid indefinite blocking

See gh-35915
This commit is contained in:
ThomazPassarelli
2023-06-15 15:17:43 -03:00
committed by Andy Wilkinson
parent cee73cebd4
commit f9da30faf1
23 changed files with 91 additions and 64 deletions

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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<Project> 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));
}
}