运行 mvn 测试时连接操作超时

Connect Operation timed out while running mvn test

我使用 online tool with kotlin extenstion. I am able to execute ./mvnw compile quarkus:dev and curl on http://localhost:8080 创建了一个新的 quarkus 项目。但是我在执行 ./mvnw test.

时遇到以下异常
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running dev.sanket.ExampleResourceTest
2020-02-20 14:06:27,010 INFO  [io.quarkus] (main) Quarkus 1.2.1.Final started in 0.411s. Listening on: http://0.0.0.0:8081
2020-02-20 14:06:27,013 INFO  [io.quarkus] (main) Profile test activated.
2020-02-20 14:06:27,013 INFO  [io.quarkus] (main) Installed features: [cdi, kotlin, resteasy]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 78.626 s <<< FAILURE! - in dev.sanket.ExampleResourceTest
[ERROR] testHelloEndpoint  Time elapsed: 76.099 s  <<< ERROR!
java.net.ConnectException: Operation timed out (Connection timed out)

知道是什么原因造成的吗?

quarkus.http.host 的默认 configuration0.0.0.0,如果你想 运行 它作为本地主机,而你只是在测试阶段,那么你可以将它添加到您的属性文件:

%test.quarkus.http.host=localhost

这就像为某个配置文件指定一组属性。它也可以应用于其他属性。

更多链接:profiling and configuration in Quarkus