Skip to content

Commit

Permalink
RabbitMQ Health Check fo test
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed May 13, 2023
1 parent 63d0e08 commit f741de7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main

env:
RABBITMQ_HOST: rabbitmq

jobs:
Build:
runs-on: 'ubuntu-latest'
Expand All @@ -30,10 +33,11 @@ jobs:
ports:
- "5672:5672"
options: >-
--health-cmd="rabbitmq-diagnostics status"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--health-cmd "rabbitmq-diagnostics status"
--health-interval "10s"
--health-timeout "5s"
--health-retries "5"
--health-start-period 10s
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion tests/RabbitMQConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ class RabbitMQConnectorTest extends TestCase

public function setUp(): void
{
$host = getenv('RABBITMQ_HOST');
if (empty($host)) {
$host = "127.0.0.1";
}
ConnectorFactory::registerConnector(RabbitMQConnector::class);
$this->connector = ConnectorFactory::create("amqp://guest:guest@127.0.0.1:5672/");
$this->connector = ConnectorFactory::create("amqp://guest:guest@$host:5672/");
}

public function testClearQueues()
Expand Down

0 comments on commit f741de7

Please sign in to comment.