feat: Add network support to the Kafka container#1316
feat: Add network support to the Kafka container#1316HofmeisterAn merged 5 commits intotestcontainers:developfrom
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
6508c74 to
b5ea6cd
Compare
|
I have some problems to run |
b5ea6cd to
0e7bb9d
Compare
|
QQ: Does this address #736 too? |
I think yes, do you want me to take the test? |
That would be really kind. Then we can link the PR to the issue. I'll try to review the PR sometime this week. |
|
Yes, this fixes #736 given the new advertised listener is added. I have an example in java working with schema registry https://github.com/eddumelendez/testcontainers-samples/blob/main/spring-boot-kafka/src/test/java/com/example/consumer/SpringBootKafkaAvroTest.java#L39-L57 |
0e7bb9d to
97af438
Compare
You can find a new commit with registry. |
…estcontainers#736 Signed-off-by: SebastienDegodez <sebastien.degodez@gmail.com>
97af438 to
50a54bd
Compare
HofmeisterAn
left a comment
There was a problem hiding this comment.
Thanks for taking the time and contributing. I just had the chance to review the PR. The PR looks good; I made a few minor changes and aligned them with the repository standards. Let me know if you're okay with it. I haven't had the time to review the tests yet, but I will either this evening or sometime tomorrow. Thanks again for the PR!
It's OK for me. The code is community no just for me. |
HofmeisterAn
left a comment
There was a problem hiding this comment.
I have completed the review and noticed that the KafkaContainerRegistryTest threw the following error:
Schema being registered is incompatible with an earlier schema for subject "user-topic-value"; error code: 409.
Was this intentional? I made changes to the schema to match the actual topic. Could you please review these changes? After that, I will be happy to merge the PR. Thanks again!
My intention was to show that the registry schema was wired correctly by rejecting a message that did not match the contracts. |
SebastienDegodez
left a comment
There was a problem hiding this comment.
Review done, it's ok for me.
Thanks for clarification, but I do not understand this. Using a different type that does not match the topic's schema will throw an exception, right? Why's that not enough? Should we extend the test and add this as a test assertion too? |
I think your test still shows that it works, the contract is stored in kafka by the SR (in topic). As you find the schema when you consume messages, I think we can say that everything is good. It's more my preference to show the interest of the SR to refuse messages with a non-compliant schema. Your approach works too. |
What does this PR do?
This PR adds the functionality to support network within a Docker container.
Why is it important?
Network isolation is crucial for testing in an environment that closely mimics production. It ensures that the containers can communicate within a controlled network, similar to how they would in a real-world scenario.
Related issues
How to test this PR
kcatcontainers.KafkaContainerNetworkTestto verify message production and consumption.Follow-ups