-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
[Bug]: Cannot connect to RabbitMQ (module) #1702
Comments
Isn't it this one? https://github.com/testcontainers/testcontainers-go/blob/main/modules/rabbitmq/examples_test.go#L48-L85 |
Oh I missed that. So is this run in CI? I wonder why my simple example above doesn't work then... |
Looking at the rabbitmq docs
So, testcontainers-go and testcontainers-java are not taking that into account for versions lower than 3.9. env vars were added in rabbitmq 3.9. @abemedia if you switch to |
It seems adding the following fixes it: rabbitmq.WithAdminUsername("admin"),
rabbitmq.WithAdminPassword("password"), Using the module without these options is definitely broken though... |
I found the issue. In both cases, declaring or not the admin credentials when container is created are |
Was running into similar issues here -- the default config in the docs isn't runnable as is. Upgrading to 3.9 def solved some issues Separately (don't mean to hijack the thread, but since this is the open RabbitMQ ticket already) feels kinda odd that these config types like
Might make sense to remove their references in the docs if we're not supposed to use em? |
@sambarnes thanks for raising your concerns on this. I had the same feeling adding them to the test files. I intentionally want to hide them from the public APIs, but still wanted to create examples for users to follow. This allowed us to decouple from the RabbitMQ implementation if it changes in the future. I now see the docs are not clear at all about that. Or maybe I'm creating a different expectation on those types, as I created them only for demonstration purposes, as examples. How would you do it to make it more evident that they are for reference, not usable at all? |
Probably, just using raw commands would be enough for the sake of examples. |
Indeed. There are some examples that are complex enough to create an abstraction, like this one: testcontainers-go/modules/rabbitmq/types_test.go Lines 41 to 67 in ae52a27
That's why I decided to encapsulate them into a struct, not making the tests less readable with the build of the raw commands. |
Yeah i was about to suggest the same^. I think raw string commands for examples would be a solid starting point. Could maybe expose a default struct that just does the simple string case for Then a footnote linking to that test file for ppl with more complex needs with custom structs? just thinking out loud here, this morning is the first i tried the rabbit example for testcontainers, so i'm not as familiar as y'all :) |
@sambarnes added here: #1905 |
@mdelapenya that PR doesn't actually fix the issue the ticket was about. |
@abemedia let's reopen it then until we get to it. But I'd like to understand better the bug in here: is it because the credentials should be there in order to make it work? #1702 (comment) If so, we can update the module to always offer defaults, and/or improve the docs to make it explicit. Would that fix that for you? In any case, please share here your thoughts 🙏 |
Testcontainers version
v0.25.0
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host arch
x86
Go version
1.21
Docker version
Docker info
What happened?
The rabbitmq module is essentially broken as the admin account can only connect from localhost (see log output from container). The following example fails with the error
Exception (403) Reason: "username or password not allowed"
It might be a good idea to add a test that attempts to connect to the created container via the Go client library.
Relevant log output
Additional information
No response
The text was updated successfully, but these errors were encountered: