Speedup WebFlux tests by reducing the interval period
In WebFlux, we have various tests using a period of 50 or 100ms. We should use a smaller value like 1ms to speedup tests. Closes gh-33738
This commit is contained in:
@@ -127,7 +127,7 @@ class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
String path = request.getURI().getPath();
|
||||
return switch (path) {
|
||||
case "/write-and-flush" -> response.writeAndFlushWith(
|
||||
testInterval(Duration.ofMillis(50), 2)
|
||||
testInterval(Duration.ofMillis(1), 2)
|
||||
.map(longValue -> wrap("data" + longValue + "\n", response))
|
||||
.map(Flux::just)
|
||||
.mergeWith(Flux.never()));
|
||||
|
||||
@@ -125,7 +125,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati
|
||||
|
||||
private static class SseHandler {
|
||||
|
||||
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 2);
|
||||
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 2);
|
||||
|
||||
Mono<ServerResponse> string(ServerRequest request) {
|
||||
return ServerResponse.ok()
|
||||
|
||||
@@ -109,7 +109,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes
|
||||
@GetMapping(value = "/stream",
|
||||
produces = { APPLICATION_NDJSON_VALUE, "application/stream+x-jackson-smile" })
|
||||
Flux<Person> person() {
|
||||
return testInterval(Duration.ofMillis(100), 50).map(l -> new Person("foo " + l));
|
||||
return testInterval(Duration.ofMillis(1), 50).map(l -> new Person("foo " + l));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class ProtobufIntegrationTests extends AbstractRequestMappingIntegrationTests {
|
||||
|
||||
@GetMapping(value = "/message-stream", produces = "application/x-protobuf;delimited=true")
|
||||
Flux<Msg> messageStream() {
|
||||
return testInterval(Duration.ofMillis(50), 5).map(l ->
|
||||
return testInterval(Duration.ofMillis(1), 5).map(l ->
|
||||
Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(l.intValue()).build()).build());
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe
|
||||
|
||||
@GetMapping("/stream")
|
||||
public Publisher<Long> stream() {
|
||||
return testInterval(Duration.ofMillis(50), 5);
|
||||
return testInterval(Duration.ofMillis(1), 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
@RequestMapping("/sse")
|
||||
static class SseController {
|
||||
|
||||
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 50);
|
||||
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 50);
|
||||
|
||||
private final Sinks.Empty<Void> cancelSink = Sinks.empty();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user