RabbitMQ Module
Hi there!
Great work bringing Testcontainers to Ruby!
I'm unable to start a RabbitMQ container using the RabbitMQ container module in an RSpec test suite. When invoking container.start, Testcontainers times out waiting for the container to become healthy. The specific error message is:
Testcontainers::TimeoutError:
Timed out waiting for health check to be healthy
However, if I use Testcontainers::DockerContainer("rabbitmq:latest), this error doesn't occur.
For context, here's the code where container.start is called:
require 'rails_helper'
require 'testcontainers/rabbitmq'
require 'bunny'
RSpec.describe "Books", type: :request do
rabbit = Testcontainers::RabbitmqContainer.new
before(:all) do
puts "Starting container"
rabbit.start
puts "Started container"
end
For reference, the puts "Started container" line is never reached.
Note that the rabbitmqctl node_health_check healthcheck option has been deprecated by RabbitMQ.
After copying the contents of https://github.com/testcontainers/testcontainers-ruby/blob/main/rabbitmq/lib/testcontainers/rabbitmq.rb and modifying it locally, I now have a Testcontainer instance starting up. Instead of using a health-check on startup, I used a wait_for_logs strategy instead.
@mlk-kc do you mind sending a PR with the change?
If node_health_check is deprecated is better to stop using it even in old versions of the images.
If you don't have time to send a PR don't worry, I can fix it later this week.
Hi @guilleiguaran : I'll make one now if that's cool? Apologies, I haven't been in work since last Wednesday!
@guilleiguaran : I've just attempted to push my local issue-20 branch but I don't think I have the rights to do this? Some console output which might help:
ERROR: Permission to testcontainers/testcontainers-ruby.git denied to mlk-kc.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
@mlk-kc you can create a fork of the project, push the branch to the fork, and open a pull request.
Just in case, this guide describes the process: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
Apologies @guilleiguaran , its been a year or two since I used GitHub in this way 😅 ! Just opened the following PR for the changes; thank you for your assistance on setting the PR up!
https://github.com/testcontainers/testcontainers-ruby/pull/28