-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Added example of using Kafka Test Containers #840
Conversation
docs/usage/kafka_containers.md
Outdated
@@ -0,0 +1,48 @@ | |||
# Kafka Containers | |||
|
|||
Test Containers can be used to automatically instantiate and manage [Kafka](https://kafka.apache.org) containers. |
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.
Test Containers
-> Testcontainers
;)
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.
Also, please use Apache Kafka
, afaik that's how we should refer to it
docs/usage/kafka_containers.md
Outdated
# Kafka Containers | ||
|
||
Test Containers can be used to automatically instantiate and manage [Kafka](https://kafka.apache.org) containers. | ||
More precisely Test Containers use official Docker images for [Confluent OSS Platform](https://hub.docker.com/r/confluentinc/cp-kafka/) |
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.
uses?
docs/usage/kafka_containers.md
Outdated
|
||
## Example | ||
|
||
The following field in your JUnit UI test class will prepare a container running Kafka: |
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.
UI test?
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.
Hrr, never push anything on Friday evening...
docs/usage/kafka_containers.md
Outdated
kafka.getBootstrapServers() | ||
``` | ||
|
||
If your test needs to run some other docker container which needs access to the Kafka, do the following: |
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.
Could you please move this section to the end of this document? So that only interested parties will read it :D
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.
Wow, this is a awesome change to the docs, thank you very much! My remarks are super small and nitpicky, I can also do the change myself, just wanted to let you know first 🙂
docs/usage.md
Outdated
@@ -25,6 +25,7 @@ Testcontainers will try to connect to a Docker daemon using the following strate | |||
|
|||
* [Temporary database containers](usage/database_containers.md) - specialized Microsoft SQL Server, MariaDB, MySQL, PostgreSQL, Oracle XE and Virtuoso container support | |||
* [Webdriver containers](usage/webdriver_containers.md) - run a Dockerized Chrome or Firefox browser ready for Selenium/Webdriver operations - complete with automatic video recording | |||
* [Kafka containers](usage/kafka_containers.md) - run a Dockerized Kafka, a distributed streaming platform |
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.
Using the word dockerized
as a verb is kind of a generic trademark, so I think we should write it with a lowercase d. Can you please fix it in the line above as well? 🙂
docs/usage/kafka_containers.md
Outdated
|
||
## Benefits | ||
|
||
* Running single node Kafka installation with just one line of code |
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.
Running a
docs/usage/kafka_containers.md
Outdated
# Kafka Containers | ||
|
||
Testcontainers can be used to automatically instantiate and manage [Apache Kafka](https://kafka.apache.org) containers. | ||
More precisely Testcontainers uses official Docker images for [Confluent OSS Platform](https://hub.docker.com/r/confluentinc/cp-kafka/) |
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.
uses the
docs/usage/kafka_containers.md
Outdated
|
||
### Selecting Kafka version | ||
|
||
You can select a version of Confluent Platform by passing it to container's constructor: |
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.
to the container's
|
||
### <a name="zookeeper"></a> Using external Zookeeper | ||
|
||
If for some reason you want to use an externally running Zookeeper, then just pass its location during construction: |
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.
just provide it's location
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 kindly disagree on this one :) https://data.grammarbook.com/blog/pronouns/1-grammar-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.
You are 100% correct of course :D
docs/usage/kafka_containers.md
Outdated
|
||
## Multi-container usage | ||
|
||
If your test needs to run some other docker container which needs access to the Kafka, do the following: |
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.
Docker with uppercase D
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 assume you were waiting on me for a native English speakers' view on the docs but, when I finally get around to looking, it looks perfect 😄 .
As we're all in agreement that this looks good, I shall merge.
We have this out in a Release Candidate build (1.9.0-rc1) for anyone who is keen to try it! |
No description provided.