Skip to content
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 Module #20

Open
mlk-kc opened this issue Aug 21, 2023 · 6 comments
Open

RabbitMQ Module #20

mlk-kc opened this issue Aug 21, 2023 · 6 comments

Comments

@mlk-kc
Copy link
Contributor

mlk-kc commented Aug 21, 2023

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.

@mlk-kc
Copy link
Contributor Author

mlk-kc commented Aug 21, 2023

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.

@guilleiguaran
Copy link
Member

guilleiguaran commented Aug 25, 2023

@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.

@mlk-kc
Copy link
Contributor Author

mlk-kc commented Aug 29, 2023

Hi @guilleiguaran : I'll make one now if that's cool? Apologies, I haven't been in work since last Wednesday!

@mlk-kc
Copy link
Contributor Author

mlk-kc commented Aug 29, 2023

@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.

@guilleiguaran
Copy link
Member

guilleiguaran commented Aug 30, 2023

@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

@mlk-kc
Copy link
Contributor Author

mlk-kc commented Aug 30, 2023

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!

#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants