In CircleCI I run an app that I would like to run the tests against:
test:
pre:
# run app
- ./gradlew bootRun -Dgrails.env=dev:
background: true
- sleep 40
override:
- ./gradlew test
On localhost the app is accessible on http://localhost:8080
. I can see the app start up on CircleCI.
I thought that I would change the host localhost
:
machine:
# Override /etc/hosts
hosts:
localhost: 127.0.0.1
My tests work locally correctly. On CircleCI
they always end up without connection when calling new HttpPost("http://localhost:8080/api");
with this error:
org.apache.http.conn.HttpHostConnectException at SendMessageSpec.groovy:44 Caused by: java.net.ConnectException at SendMessageSpec.groovy:44
I had to increase the sleep time to something unreasonably big. - sleep 480
I think I'll have a look at how to block tests until the app is started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With