Skip to content

Commit 0142648

Browse files
committed
Enforce timeout in WebFlux multipart tests
1 parent 8b5f5d9 commit 0142648

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

spring-webflux/src/test/java/org/springframework/web/reactive/function/MultipartIntegrationTests.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.nio.file.Files;
2121
import java.nio.file.Path;
2222
import java.nio.file.Paths;
23+
import java.time.Duration;
2324
import java.util.Map;
2425

2526
import reactor.core.publisher.Mono;
@@ -72,7 +73,8 @@ void multipartData(HttpServer httpServer) throws Exception {
7273
StepVerifier
7374
.create(result)
7475
.consumeNextWith(entity -> assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK))
75-
.verifyComplete();
76+
.expectComplete()
77+
.verify(Duration.ofSeconds(5));
7678
}
7779

7880
@ParameterizedHttpServerTest
@@ -89,7 +91,8 @@ void parts(HttpServer httpServer) throws Exception {
8991
StepVerifier
9092
.create(result)
9193
.consumeNextWith(entity -> assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK))
92-
.verifyComplete();
94+
.expectComplete()
95+
.verify(Duration.ofSeconds(5));
9396
}
9497

9598
@ParameterizedHttpServerTest
@@ -119,7 +122,8 @@ void transferTo(HttpServer httpServer) throws Exception {
119122
fail("IOException", ex);
120123
}
121124
})
122-
.verifyComplete();
125+
.expectComplete()
126+
.verify(Duration.ofSeconds(5));
123127
}
124128

125129
private MultiValueMap<String, HttpEntity<?>> generateBody() {
@@ -193,8 +197,7 @@ private Mono<Path> createTempFile() {
193197
catch (IOException ex) {
194198
return Mono.error(ex);
195199
}
196-
})
197-
.subscribeOn(Schedulers.boundedElastic());
200+
}).subscribeOn(Schedulers.boundedElastic());
198201
}
199202

200203
}

0 commit comments

Comments
 (0)