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

Added example of using Kafka Test Containers #840

Merged
merged 3 commits into from
Aug 26, 2018

Conversation

iNikem
Copy link
Contributor

@iNikem iNikem commented Aug 17, 2018

No description provided.

@@ -0,0 +1,48 @@
# Kafka Containers

Test Containers can be used to automatically instantiate and manage [Kafka](https://kafka.apache.org) containers.
Copy link
Member

Choose a reason for hiding this comment

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

Test Containers -> Testcontainers ;)

Copy link
Member

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

# 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/)
Copy link
Member

Choose a reason for hiding this comment

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

uses?


## Example

The following field in your JUnit UI test class will prepare a container running Kafka:
Copy link
Member

Choose a reason for hiding this comment

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

UI test?

Copy link
Contributor Author

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...

kafka.getBootstrapServers()
```

If your test needs to run some other docker container which needs access to the Kafka, do the following:
Copy link
Member

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

@bsideup bsideup added this to the next milestone Aug 17, 2018
@bsideup
Copy link
Member

bsideup commented Aug 17, 2018

@iNikem amazing, thank you! 😍 One of the best types of contributions 👍

I'll keep it open to let @kiview and @rnorth review the wording but I'm super happy with the content, good job 👍

Copy link
Member

@kiview kiview left a 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
Copy link
Member

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? 🙂


## Benefits

* Running single node Kafka installation with just one line of code
Copy link
Member

Choose a reason for hiding this comment

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

Running a

# 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/)
Copy link
Member

Choose a reason for hiding this comment

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

uses the


### Selecting Kafka version

You can select a version of Confluent Platform by passing it to container's constructor:
Copy link
Member

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:
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

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


## Multi-container usage

If your test needs to run some other docker container which needs access to the Kafka, do the following:
Copy link
Member

Choose a reason for hiding this comment

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

Docker with uppercase D

Copy link
Member

@rnorth rnorth left a 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.

@rnorth rnorth merged commit 92d720c into testcontainers:master Aug 26, 2018
@rnorth
Copy link
Member

rnorth commented Sep 10, 2018

We have this out in a Release Candidate build (1.9.0-rc1) for anyone who is keen to try it!

Release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants