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

feat: add RabbitMQ support #1618

Merged
merged 45 commits into from
Sep 21, 2023
Merged

Conversation

mdelapenya
Copy link
Collaborator

@mdelapenya mdelapenya commented Sep 13, 2023

What does this PR do?

This PR adds the RabbitMQ module, using Java module as reference implementation: all the options are implemented (see docs site)

It also fixes docs in postgres (a block that was removed) and the examples template, wording.

To implement the execution of startup commands, as demonstrated in the testable examples for this module, we are consuming the testcontainers.WithStartupCommand functional option from the core, which accepts a variadic argument of testcontainers.Executable. The latter is an interface with one single method: AsCommand() []string. Therefore, users of the RabbitMQ module (and eventually any other module) will be able to run arbitrary commands on the container right after it has started. The users will be responsible of creating valid commands.

NOTE: we are sharing some examples on how to create those commands. Please take a look at the types_test.go file.

All the options in the RabbitMQ module will be rendered into a .conf file, which will be the default configuration for the RabbitMQ container. We will leverage Go templates to render this conf file.

Why is it important?

More modules!

@mdelapenya mdelapenya requested a review from a team as a code owner September 13, 2023 23:03
@mdelapenya mdelapenya added the feature New functionality or new behaviors on the existing one label Sep 13, 2023
@mdelapenya mdelapenya self-assigned this Sep 13, 2023
@netlify
Copy link

netlify bot commented Sep 13, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 4539d8d
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/650c1d65da9ddd0007d37161
😎 Deploy Preview https://deploy-preview-1618--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

modules/rabbitmq/rabbitmq.go Outdated Show resolved Hide resolved
// listed below are deprecated and no longer used. Please use a configuration file instead;
// visit https://rabbitmq.com/configure to learn more about the configuration file. For a starting point,
// the 3.8 images will print out the config file it generated from supplied environment variables.
func WithSSL(sslSettings SSLSettings) testcontainers.CustomizeRequestOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take into account the following PR comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not implemented yet the SSL improvements. Should I proceed with the current state or rework the PR to remove the usage of the deprecated variables. It will define the lower version of RabbitMQ to use: +3.9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO new Testcontainers implementations should take into account the most generic and compatible approach. In this case, using the configuration file is an option which will work for versions older than 3.9 and new ones. The implementation will differ from Testcontainers for Java but I think it will be a good one too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I will use that PR comment for the implementation. One thing I noticed regarding the env_vars: at this moment, the RabbitMQ module in tc-java, using SSL and setting the image to +3.9, will fail with a deprecation notice.

* main:
  fix: proper next version
  chore: prepare for next minor development cycle ()
  chore: use new version (v0.24.0) in modules and examples
  fix: include sonarcloud file into the release commit
  modulegen: generate sonar configuration (testcontainers#1644)
  feat: define test session semantics (testcontainers#1513)
  chore(deps): bump actions/checkout from 3 to 4 (testcontainers#1623)
We are gonig to build our own config
* main:
  docs: have common options in a common markdown file (testcontainers#1648)
  feat: add functional option for startup commands (testcontainers#1647)
  fix: support running the semver Docker image interactively (testcontainers#1646)
  fix: proper next version
  chore: prepare for next minor development cycle ()
  chore: use new version (v0.24.1) in modules and examples
  fix: avoid deadlocks when Docker is not available (testcontainers#1645)
@mdelapenya
Copy link
Collaborator Author

@eddumelendez I think this is ready to Go!

@mdelapenya
Copy link
Collaborator Author

@eddumelendez we are going to merge this, and because it's not released yet, we can improve it in follow-up PRs.

@mdelapenya mdelapenya merged commit a285e86 into testcontainers:main Sep 21, 2023
107 checks passed
@mdelapenya mdelapenya deleted the rabbitmq-module branch September 26, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality or new behaviors on the existing one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants