Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

RabbitMQ integration test in Bitbucket Pipelines

Krzysztof Gardziejewski June 14, 2018

Hello,

I have set of integration test which deal with some services like Mongo and RabbitMQ. Test for Mongo integration works fine, but when I added RabbitMQ to services it doesn't work. It's look like inaccessible.

It's my pipelines file:

image: prooph/php:7.2-fpm-xdebug

pipelines:
default:
- step:
name: integration tests
caches:
- composer
script:
- apt-get update && apt-get install -y unzip git
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- composer test:integration
services:
- broker
- readmodel

definitions:
services:
readmodel:
image: mongo:latest
environment:
MONGODB_USER: devread
MONGODB_PASS: devread
MONGODB_DATABASE: ds
MONGO_DATA_DIR: /data/db
command: mongod --smallfiles
broker:
image: rabbitmq:3
environment:
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq
ports:
- 5672:5672

And output from console:

1) Test\Integration\MessageBroker\Consumer\RabbitMQTest::whenMessageIsOnQueueThenConsumerShouldReturnItErrorException: stream_socket_client(): unable to connect to tcp://127.0.0.1:5672 (Connection refused)/opt/atlassian/pipelines/agent/build/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php:141/opt/atlassian/pipelines/agent/build/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php:205/opt/atlassian/pipelines/agent/build/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php:189/opt/atlassian/pipelines/agent/build/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AMQPStreamConnection.php:60/opt/atlassian/pipelines/agent/build/test/integration/MessageBroker/RabbitMQTestCase.php:35/opt/atlassian/pipelines/agent/build/test/integration/MessageBroker/RabbitMQTestCase.php:76/opt/atlassian/pipelines/agent/build/test/integration/MessageBroker/RabbitMQTestCase.php:19

1 answer

1 vote
Krzysztof Gardziejewski June 14, 2018

It's my mistake, I should use localhost address in tests instead 127.0.0.1

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events