-
-
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
Use new apache/kafka-native docker image for kafka module #2683
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
||
// validateKRaftVersion validates if the image version is compatible with KRaft mode, | ||
// which is available since version 7.0.0. | ||
func validateKRaftVersion(fqName string) error { |
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.
every apache/kafka-native image supports kraft
|
||
hostname := inspect.Config.Hostname | ||
|
||
code, r, err := container.Exec(context.Background(), []string{"cat", "/usr/sbin/testcontainers_start.sh"}) |
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.
this script doesn't exist anymore in the kafka image - also I didn't think it was necessary to check advertisted listeners, considering if it's set incorrectly, the other tests would fail because kafka wouldn't work in the first place
@@ -17,7 +15,7 @@ func TestKafka(t *testing.T) { | |||
|
|||
ctx := context.Background() | |||
|
|||
kafkaContainer, err := kafka.Run(ctx, "confluentinc/confluent-local:7.5.0", kafka.WithClusterID("kraftCluster")) | |||
kafkaContainer, err := kafka.Run(ctx, "apache/kafka-native:3.8.0", kafka.WithClusterID("kraftCluster")) |
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.
TODO: need some more tests on the client side to demonstrate this works + add tests for setting host port
What does this PR do?
Uses the new apache/kafka-native docker image instead of the confluent local docker image. The kafka native docker image is much faster (startup time is maybe a second once the image is downloaded).
Trying to see if there is a desire from the community to use this. I can also add support for authentication mechanisms like SASL_PLAINTEXT if desired.
A current limitation of this however is that the desired host port must be known at container creation time - unlike before where we could dynamically pick a port at runtime. The way it was done before was a bit strange, it was running a kafka instance after the container had already started up I believe, which allowed it to pick the right port to use. Here, when we start up the kafka container it must know the port already.
We can still support picking random ports with some tricks like this, but there's no guarantee there won't be collisions.
Also I realize some of these changes may cause unavoidable breaking changes, so I'm happy to make a v2 module.
Why is it important?
Related issues