[Windows 10 和 MAC] 尝试使用分布式测试在 docker 上运行空手道测试用例,但未按预期工作,并且在工作节点上出现错误。
错误:
21:34:34.263 [main] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to karate:9080 [karate/172.18.0.2] failed: Connection refused (Connection refused), http call failed after 3 milliseconds for url: http://karate:9080/healthcheck
21:34:36.266 [main] DEBUG com.intuit.karate.shell.Command - attempt #30 waiting for http to be ready at: http://karate:9080/healthcheck
21:34:36.270 [main] DEBUG com.intuit.karate - request:
31 > GET http://karate:9080/healthcheck
31 > Host: karate:9080
31 > Connection: Keep-Alive
31 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_275)
31 > Accept-Encoding: gzip,deflate
参考链接:[分布式测试] https://github.com/karatelabs/karate/wiki/Distributed-Testing
使用上述网站上提到的作业服务器示例项目。https://github.com/intuit/karate/tree/develop/examples/jobserver
使用的命令:
docker run --network=karate --name karate --cap-add=SYS_ADMIN -w /src karate bash mvn clean test -Dtest=WebDockerJobRunner
docker run -d --network=karate --rm --cap-add=SYS_ADMIN -e KARATE_JOBURL=http://karate:9080 karate