Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CircleCI - how to connect to localhost

Tags:

circleci

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

like image 963
Amio.io Avatar asked Nov 09 '22 07:11

Amio.io


1 Answers

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.

like image 113
Amio.io Avatar answered Dec 15 '22 23:12

Amio.io