I wrote some integration tests using Guzzle. I also created a pipeline on bitbucket to run the tests.
$this->client = new Client([ 'base_uri' => "http://{docker_service_name}/api/", ]); $response = $this->client->request('GET', 'regions'); $this->assertEquals(SELF::STATUS_OK, $response->getStatusCode());
My bitbucket-pipeline.yaml looks similar to this:
image: php:7.1.1 pipelines: default: - step: script: - apt-get update && apt-get install -y unzip - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - composer install - vendor/bin/phpunit
The problem is that the pipeline fails with the following error:
GuzzleHttp\Exception\ConnectException: cURL error 7: Failed to connect to docker_service_name port 80: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://{docker_service_name}/api/regions
Looks like the pipeline can't get the hostname, on my local it would be the name of the docker web server, what should I set on the pipeline? Thank you very much in advance
Please note that the step script is executed in a single docker container. If you need to connect to some other service to run integration tests, you should: