Polish "Replace calls to verifyComplete() to avoid indefinite blocking"

See gh-35915
This commit is contained in:
Andy Wilkinson
2023-06-23 12:17:07 +01:00
parent f9da30faf1
commit d2966e1cbf
25 changed files with 159 additions and 89 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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