Hello,
I investigate few flaky unit tests that very rarely fail in our test suite for opentelemetry instrumentation for amqplib package in nodejs
Link to the repo:
I suspect that the issue is somehow related to rabbitmq not purging a queue correctly after nackAll.
My use case is:
I run rabbitmq in docker in the CI (github actions):
Test #1 (test nackAll behaviour)
- send 2 messages to queue
- consume the 2 messages from the queue
- call nackAll on the queue (with requeue).
Test #2 (test reject behaviour):
- purge the queue from messages (at this point I expect the queue to be empty)
- send 1 message to queue
- consume message from the queue
for test #2 I expect that consume will return only 1 message, as I purged the queue before starting the test. In reality, I do get 1 message most of the times, but one out of few dozens runs I sometimes get 3 messages which causes the tests to fail (probably the 2 nackAll messages from the previous test which were not cleaned correctly with purgeQueue)
I would guess that rabbitmq internally is not executing the commands synchronously. Would appreciate any help or insights on this issue as I'm kind of stuck currently with making the tests deterministic with rabbitmq api.
Thanks, Amir