Connect Operation timed out while running mvn test

感情迁移 提交于 2021-02-11 15:27:21

问题


I have created a new quarkus project using online tool with kotlin extenstion. I am able to execute ./mvnw compile quarkus:dev and curl on http://localhost:8080. However I am getting following exception while executing ./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)

Any idea what is causing this?


回答1:


Default configuration for quarkus.http.host is 0.0.0.0, if you want to run it as localhost while you are only in test phase, then you can add this to your properties file :

%test.quarkus.http.host=localhost

It is like specifying a set of properties for certain profile. It can be applied to other properties as well.

Further links : profiling and configuration in Quarkus.



来源:https://stackoverflow.com/questions/60312410/connect-operation-timed-out-while-running-mvn-test

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!