Skip to content

Commit

Permalink
fixing mq connection
Browse files Browse the repository at this point in the history
  • Loading branch information
basz committed Sep 14, 2023
1 parent f368ed6 commit e8f0950
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: Namoshek/rabbitmq-github-action@v1.1.0
with:
version: "3.8.9"
ports: "5672:5672 15672:15672"
ports: "5672:5672 5671:5671 15672:15672"
certificates: ${{ github.workspace }}/provision/test_certs
config: ${{ github.workspace }}/provision/rabbitmq.config
definitions: ${{ github.workspace }}/provision/definitions.json
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractCallbackConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ function (Envelope $envelope, Queue $queue) use (&$result): DeliveryResult {
*/
public function it_handles_flush_deferred_after_timeout(): void
{
$connection = $this->createConnection(new ConnectionOptions(['read_timeout' => 1]));
$connection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'read_timeout' => 1]));
$channel = $connection->newChannel();

$exchange = $channel->newExchange();
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractChannelRecoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function it_recovers(): void

$queue1->cancel(); // we have to do that to prevent redelivering to the same consumer

$newConnection = $this->createConnection(new ConnectionOptions(['read_timeout' => 1]));
$newConnection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'read_timeout' => 1]));
$channel2 = $newConnection->newChannel();
$channel2->setPrefetchCount(8);

Expand Down
4 changes: 2 additions & 2 deletions tests/AbstractExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function it_publishes_with_confirms(): void
$result[] = $errstr;
});

$connection = $this->createConnection(new ConnectionOptions(['read_timeout' => 2]));
$connection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'read_timeout' => 2]));
$channel = $connection->newChannel();
$channel->confirmSelect();

Expand Down Expand Up @@ -381,7 +381,7 @@ public function it_throws_exception_when_negative_wait_confirm_timeout_given():
$this->expectException(ChannelException::class);
$this->expectExceptionMessage('Timeout must be greater than or equal to zero.');

$connection = $this->createConnection(new ConnectionOptions(['read_timeout' => 2]));
$connection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'read_timeout' => 2]));
$channel = $connection->newChannel();
$channel->confirmSelect();

Expand Down
2 changes: 1 addition & 1 deletion tests/AmqpExtension/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function it_throws_exception_when_cannot_create_channel(): void
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Could not create channel. No connection available.');

$connection = new Connection(new ConnectionOptions());
$connection = new Connection(new ConnectionOptions(['host' => 'rabbitmq']));

$connection->newChannel();
}
Expand Down
10 changes: 5 additions & 5 deletions tests/AmqpExtension/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function it_connects_with_valid_credentials(): void
*/
public function it_uses_persistent_connection(): void
{
$connection = $this->createConnection(new ConnectionOptions(['persistent' => true]));
$connection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'persistent' => true]));

$this->assertTrue($connection->isConnected());

Expand Down Expand Up @@ -100,7 +100,7 @@ public function it_reconnects(): void
*/
public function it_reconnects_a_persistent_connection(): void
{
$connection = $this->createConnection(new ConnectionOptions(['persistent' => true]));
$connection = $this->createConnection(new ConnectionOptions(['host' => 'rabbitmq', 'persistent' => true]));

$this->assertTrue($connection->isConnected());

Expand All @@ -125,7 +125,7 @@ public function it_returns_internal_connection(): void
*/
public function it_connects_with_ssl(): void
{
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
$options->setVhost('/humus-amqp-test');
$options->setPort(5671);
$options->setCaCert(__DIR__ . '/../../provision/test_certs/cacert.pem');
Expand All @@ -150,7 +150,7 @@ public function it_connects_with_ssl(): void
*/
public function it_connects_with_only_cacert(): void
{
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);

$options->setVhost('/humus-amqp-test');
$options->setPort(5671);
Expand All @@ -173,7 +173,7 @@ public function it_throws_if_cacert_not_set_but_verify_is_set_to_true(): void
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('CA cert not set, so it can\'t be verified.');

$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);

$options->setVhost('/humus-amqp-test');
$options->setPort(5671);
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpAmqpLib/Helper/CreateConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait CreateConnectionTrait
public function createConnection(?ConnectionOptions $options = null): \Humus\Amqp\Connection
{
if (null === $options) {
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
}

$options->setVhost('/humus-amqp-test');
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpAmqpLib/LazyConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function it_returns_internal_connection(): void
public function createConnection(?ConnectionOptions $options = null): \Humus\Amqp\Connection
{
if (null === $options) {
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
}

$options->setVhost('/humus-amqp-test');
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpAmqpLib/SocketConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function it_returns_internal_connection(): void
public function createConnection(?ConnectionOptions $options = null): \Humus\Amqp\Connection
{
if (null === $options) {
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
}

return new SocketConnection($options);
Expand Down
6 changes: 3 additions & 3 deletions tests/PhpAmqpLib/SslConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function it_throws_exception_with_invalid_credentials(): void
*/
public function it_connects_with_only_cacert(): void
{
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);

$options->setVhost('/humus-amqp-test');
$options->setPort(5671);
Expand Down Expand Up @@ -131,7 +131,7 @@ public function it_throws_if_cacert_not_set_but_verify_is_set_to_true(): void
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('CA cert not set, so it can\'t be verified.');

$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);

$options->setVhost('/humus-amqp-test');
$options->setPort(5671);
Expand All @@ -143,7 +143,7 @@ public function it_throws_if_cacert_not_set_but_verify_is_set_to_true(): void
public function createConnection(?ConnectionOptions $options = null): \Humus\Amqp\Connection
{
if (null === $options) {
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
}

$options->setVhost('/humus-amqp-test');
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpAmqpLib/StreamConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function it_throws_exception_on_disconnect(): void
public function createConnection(?ConnectionOptions $options = null): Connection
{
if (null === $options) {
$options = new ConnectionOptions();
$options = new ConnectionOptions(['host' => 'rabbitmq']);
}

$options->setVhost('/humus-amqp-test');
Expand Down

0 comments on commit e8f0950

Please sign in to comment.