Several tests from WebClientIntegrationTests
are failing for me locally when port 80 is in use. To reproduce this ensure the build is not pulling results from the cache.
$ nc -vz localhost 80
Connection to localhost (127.0.0.1) 80 port [tcp/http] succeeded!
$ ./gradlew clean --no-build-cache :spring-webflux:test --tests "org.springframework.web.reactive.function.client.WebClientIntegrationTests"
> Task :spring-beans:compileTestFixturesJava
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/Nullable.class: warning: Cannot find annotation method 'when()' in type 'Nonnull': class file for javax.annotation.Nonnull not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/NonNullApi.class: warning: Cannot find annotation method 'value()' in type 'TypeQualifierDefault': class file for javax.annotation.meta.TypeQualifierDefault not found
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/NonNullFields.class: warning: Cannot find annotation method 'value()' in type 'TypeQualifierDefault'
4 warnings
> Task :spring-webflux:test
WebClientIntegrationTests > malformedResponseChunksOnBodilessEntity(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.malformedResponseChunksOnBodilessEntity(ClientHttpConnector)[3] FAILED
java.lang.AssertionError at MessageFormatter.java:115
WebClientIntegrationTests > malformedResponseChunksOnEntityWithBody(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.malformedResponseChunksOnEntityWithBody(ClientHttpConnector)[3] FAILED
java.lang.AssertionError at MessageFormatter.java:115
WebClientIntegrationTests > exchangeWithRelativeUrl(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.exchangeWithRelativeUrl(ClientHttpConnector)[1] FAILED
java.lang.AssertionError at MessageFormatter.java:115
WebClientIntegrationTests > exchangeWithRelativeUrl(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.exchangeWithRelativeUrl(ClientHttpConnector)[2] FAILED
java.lang.AssertionError at MessageFormatter.java:115
WebClientIntegrationTests > exchangeWithRelativeUrl(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.exchangeWithRelativeUrl(ClientHttpConnector)[3] FAILED
java.lang.AssertionError at MessageFormatter.java:115
WebClientIntegrationTests > exchangeWithRelativeUrl(ClientHttpConnector) > org.springframework.web.reactive.function.client.WebClientIntegrationTests.exchangeWithRelativeUrl(ClientHttpConnector)[4] FAILED
java.lang.AssertionError at MessageFormatter.java:115
165 tests completed, 6 failed
> Task :spring-webflux:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':spring-webflux:test'.
> There were failing tests. See the report at: file:///home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-webflux/build/reports/tests/test/index.html
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 21s
93 actionable tasks: 74 executed, 19 up-to-date
A build scan was not published as you have not authenticated with server 'ge.spring.io'.
$ systemctl stop nginx.service
$ nc -vz localhost 80
nc: connect to localhost (127.0.0.1) port 80 (tcp) failed: Connection refused
$ ./gradlew clean --no-build-cache :spring-webflux:test --tests "org.springframework.web.reactive.function.client.WebClientIntegrationTests"
> Task :spring-beans:compileTestFixturesJava
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/Nullable.class: warning: Cannot find annotation method 'when()' in type 'Nonnull': class file for javax.annotation.Nonnull not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/NonNullApi.class: warning: Cannot find annotation method 'value()' in type 'TypeQualifierDefault': class file for javax.annotation.meta.TypeQualifierDefault not found
/home/vpavic/dev/projects/spring-projects/spring-framework/worktree-main/spring-core/build/classes/java/main/org/springframework/lang/NonNullFields.class: warning: Cannot find annotation method 'value()' in type 'TypeQualifierDefault'
4 warnings
BUILD SUCCESSFUL in 20s
93 actionable tasks: 74 executed, 19 up-to-date
A build scan was not published as you have not authenticated with server 'ge.spring.io'.
Comment From: sbrannen
What happens if you add the following to org.springframework.web.reactive.function.client.WebClientIntegrationTests.startServer(ClientHttpConnector)
?
try {
this.server.start(0);
}
catch (IOException ex) {
throw new UncheckedIOException(ex);
}
Comment From: vpavic
The outcome is the same.
Just to make sure I understood correctly what you meant, this is what I did locally:
$ git diff
diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
index 80e068a474..488a38b0d0 100644
--- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
+++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
@@ -116,6 +116,12 @@ class WebClientIntegrationTests {
private void startServer(ClientHttpConnector connector) {
this.server = new MockWebServer();
+ try {
+ this.server.start(0);
+ }
+ catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
this.webClient = WebClient
.builder()
.clientConnector(connector)
Comment From: sbrannen
The outcome is the same.
OK. Thanks for trying it out.
Just to make sure I understood correctly what you meant, this is what I did locally:
Yes, that's what I meant. I hoped it would use an ephemeral port other than 80, but it was admittedly a shot in the dark since I don't really have time to investigate it at the moment.
Maybe you or somebody else from the Framework team can look into it.
Comment From: vpavic
I had a quick look and to me this doesn't look like an issue with the mock server.
Failures in WebClientIntegrationTests#exchangeWithRelativeUrl
happen on all connector implementations, and it looks like the same (or at least similar) problem as #20337.
Regarding the other two failures, they look Jetty specific.
Comment From: sdeleuze
FYI the Jetty flaky tests have been fixed via #29862.