Hi everyone,
I’ve encountered an issue with my tests. The AppConfig.ready()
method runs before I set up my test environment using testcontainers
for RabbitMQ.
My project consists of three apps.
One of these apps has a thread that listens to a RabbitMQ queue (where another worker acts as the producer, sending updated attributes of a model) and updates entities accordingly.
I start this thread in the .ready()
method of my custom AppConfig
subclass. First, I initialize the connection to RabbitMQ and then launch my listener. Everything works fine when running the app locally with docker-compose, but I encounter an issue during testing.
For testing, I need to first initialize a RabbitMQ container using testcontainers
. I initially planned to do this within DiscoverRunner.setup_test_environment()
, but I realized that AppConfig.ready()
gets executed before this setup, leading to errors.
Is there any way to delay the execution of AppConfig.ready()
until after DiscoverRunner.setup_test_environment()
? Or would I need to run a script to initialize the test container before launching my tests (which isn’t the cleanest solution)?
Thanks a lot in advance for your help!