Skip to content

Commit bd749c4

Browse files
fix: rabbitmq readiness probe
Add pika AMQPConnectionError to transient errors
1 parent 1223583 commit bd749c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/rabbitmq/testcontainers/rabbitmq/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def __init__(
5151
self.with_env("RABBITMQ_DEFAULT_USER", self.username)
5252
self.with_env("RABBITMQ_DEFAULT_PASS", self.password)
5353

54-
@wait_container_is_ready(pika.exceptions.IncompatibleProtocolError)
54+
@wait_container_is_ready(
55+
pika.exceptions.IncompatibleProtocolError, pika.exceptions.AMQPConnectionError
56+
)
5557
def readiness_probe(self) -> bool:
5658
"""Test if the RabbitMQ broker is ready."""
5759
connection = pika.BlockingConnection(self.get_connection_params())
@@ -66,7 +68,9 @@ def get_connection_params(self) -> pika.ConnectionParameters:
6668
For more details see:
6769
https://pika.readthedocs.io/en/latest/modules/parameters.html
6870
"""
69-
credentials = pika.PlainCredentials(username=self.username, password=self.password)
71+
credentials = pika.PlainCredentials(
72+
username=self.username, password=self.password
73+
)
7074

7175
return pika.ConnectionParameters(
7276
host=self.get_container_host_ip(),

0 commit comments

Comments
 (0)