Skip to content

Commit 4c44b91

Browse files
committed
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
1 parent 912c067 commit 4c44b91

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response)
127127
String path = request.getURI().getPath();
128128
return switch (path) {
129129
case "/write-and-flush" -> response.writeAndFlushWith(
130-
testInterval(Duration.ofMillis(50), 2)
130+
testInterval(Duration.ofMillis(1), 2)
131131
.map(longValue -> wrap("data" + longValue + "\n", response))
132132
.map(Flux::just)
133133
.mergeWith(Flux.never()));

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void sseAsEvent(HttpServer httpServer) throws Exception {
125125

126126
private static class SseHandler {
127127

128-
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 2);
128+
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 2);
129129

130130
Mono<ServerResponse> string(ServerRequest request) {
131131
return ServerResponse.ok()

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static class JacksonStreamingController {
109109
@GetMapping(value = "/stream",
110110
produces = { APPLICATION_NDJSON_VALUE, "application/stream+x-jackson-smile" })
111111
Flux<Person> person() {
112-
return testInterval(Duration.ofMillis(100), 50).map(l -> new Person("foo " + l));
112+
return testInterval(Duration.ofMillis(1), 50).map(l -> new Person("foo " + l));
113113
}
114114

115115
}

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Flux<Msg> messages() {
168168

169169
@GetMapping(value = "/message-stream", produces = "application/x-protobuf;delimited=true")
170170
Flux<Msg> messageStream() {
171-
return testInterval(Duration.ofMillis(50), 5).map(l ->
171+
return testInterval(Duration.ofMillis(1), 5).map(l ->
172172
Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(l.intValue()).build()).build());
173173
}
174174

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public String uri(ServerHttpRequest request) {
177177

178178
@GetMapping("/stream")
179179
public Publisher<Long> stream() {
180-
return testInterval(Duration.ofMillis(50), 5);
180+
return testInterval(Duration.ofMillis(1), 5);
181181
}
182182
}
183183

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void serverDetectsClientDisconnect(HttpServer httpServer, ClientHttpConnector co
202202
@RequestMapping("/sse")
203203
static class SseController {
204204

205-
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 50);
205+
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 50);
206206

207207
private final Sinks.Empty<Void> cancelSink = Sinks.empty();
208208

0 commit comments

Comments
 (0)