-
-
Notifications
You must be signed in to change notification settings - Fork 502
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 Redpanda module #1058
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, @weeco! In Testcontainers for Java, Redpanda module was introduced and the image used to simplify the configuration was docker.redpanda.com/vectorized/redpanda:v22.2.1
. We already use docker.redpanda.com/redpandadata/redpanda
. I was wondering if, in order to keep consistency cross-language implementation we can do the same. Recently, there have been some changes in Testcontainers for Go
in order to introduces container lifecycle, see #1036 #1037. I also wonder how the redpanda.yaml.tpl
plays with the config we already have in Testcontainers for Java
in order to enable more features.
Hey @eddumelendez , Regarding container lifecycles - I totally forgot about that; I'll look into them later today. I think the PostStart hook may work here.
In general I'd say that the Go module supports way more features. The Java module seems to rely on our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weeco thanks for this great module! Looks pretty neat!
I only have one small nit, that we could address in a follow up PR (or here, whatever you prefer): after merging with upstream, there is a need to run go mod tidy
, which is trivial.
I'm also adding a suggestion for the docs, as we added a tag icon with the version in which a module was introduced.
Other than that, great job!! Thanks!
8e481e4
to
b32bcdf
Compare
Thanks for reviewing @mdelapenya and @eddumelendez . I committed your suggested change, also tidied the Go modules and squashed my commits. I'm unsure how to address @eddumelendez's comment as this client is just a HTTP wrapper to create the Redpanda users once the cluster is started. This is only needed if the user uses authentication. If we remove this feature the user would be in charge of creating the users on their own via the Redpanda admin client that is being used. |
As commented online, I good step to avoid a dependency would be a little of copying :) I wonder if you could copy the code you need from the |
@mdelapenya I replaced the rpk dependency by adding a little helper client which currently only supports this specific endpoint for adding users. Appreciate another pass on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weeco thanks for this contribution. I liked a lot reviewing the templating part, which I think will help with an upcoming support for different versions.
LGTM!
//go:embed mounts/redpanda.yaml.tpl | ||
nodeConfigTpl string | ||
|
||
//go:embed mounts/bootstrap.yaml.tpl | ||
bootstrapConfigTpl string | ||
|
||
//go:embed mounts/entrypoint-tc.sh | ||
entrypoint []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked this to embed the static resources! 👏
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What does this PR do?
This PR adds a module for Redpanda.
Why is it important?
Redpanda is a Kafka API compatible streaming solution. Compared to Apache Kafka this starts very quickly, is easier to operate, doesn't require ZooKeeper, it's very lightweight and also comes with schema registry on board which makes it the ideal testcontainer for users that want to test their Kafka services.
Related issues
Run the provided go test.