-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RabbitMQ startup fails due to missing wait/retry #348
Comments
Thanks for reporting. Could you please provide all the information requested in the issue template? |
I can not share all python packages, but I think that's not necessary anyhow. Our fix to make it work was from pika.connection import Parameters
Parameters.DEFAULT_CONNECTION_ATTEMPTS = 10
test_container.start() |
Two more questions: Could you please also share the traceback? Does this test work on your machine? testcontainers-python/rabbitmq/testcontainers/rabbitmq/__init__.py Lines 17 to 24 in 8a3a958
|
I came across the same problem. The Job output for running a basic publish/receive test: $ pytest -s tests/test_debug_ci_cd/test_rabbitmq.py
============================= test session starts ==============================
platform linux -- Python 3.10.9, pytest-7.4.0, pluggy-1.2.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /builds/jda/debug_ci_cd
configfile: setup.cfg
collecting ... collected 1 item
tests/test_debug_ci_cd/test_rabbitmq.py::test_send Pulling image rabbitmq:latest
Container started: 6a67cf3f6ac0
Waiting to be ready...
Waiting to be ready...
Connection attempt '1' of '121' failed: Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/testcontainers/core/waiting_utils.py", line 49, in wrapper
return wrapped(*args, **kwargs)
File "/builds/jda/debug_ci_cd/tests/test_debug_ci_cd/test_rabbitmq.py", line 87, in readiness_probe
connection = pika.BlockingConnection(self.get_connection_params())
File "/usr/local/lib/python3.10/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
self._impl = self._create_connection(parameters, _impl_class)
File "/usr/local/lib/python3.10/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
Waiting to be ready...
...
Connection attempt '5' of '121' failed: Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/testcontainers/core/waiting_utils.py", line 49, in wrapper
return wrapped(*args, **kwargs)
File "/builds/jda/debug_ci_cd/tests/test_debug_ci_cd/test_rabbitmq.py", line 87, in readiness_probe
connection = pika.BlockingConnection(self.get_connection_params())
File "/usr/local/lib/python3.10/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
self._impl = self._create_connection(parameters, _impl_class)
File "/usr/local/lib/python3.10/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
Waiting to be ready...
Waiting to be ready...
PASSED
============================== 1 passed in 12.34s ==============================
Cleaning up project directory and file based variables
00:01
Job succeeded
Another fix is to add |
Add pika AMQPConnectionError to transient errors fixes #348 --------- Co-authored-by: David Ankin <[email protected]>
Describe the bug
The RabbitMQ container fails to start up properly.
To Reproduce
Runtime environment
uname -a
Darwin MABP-C02FW18CMD6V 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64
python --version
Python 3.8.11
docker info
pika 1.3.1
testcontainers 3.7.1
I am happy to contribute a PR. Assuming that the current tests pass just fine in the pipeline. Are there any tests to simulate a slower container startup?
The text was updated successfully, but these errors were encountered: