Add TestKit#4442
Closed
cmccabe wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
This has been implemented, although in a slightly different form. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proof of concept of some ideas for making a public Kafka cluster testing interface. The main idea here is that you have a public, stable interface where you can easily spin up a Kafka cluster for testing with code like this:
Because the MiniKafkaCluster extends AutoCloseable, it can be used in a Java7 try-with-resources block. It will be automatically closed when it goes out of scope.
Because we use builders everywhere, it is possible to easily add new parameters to any of the classes without breaking backwards compatibility. For example, we could add a way to configure the port or address that each Kafka node binds to when it starts up, and so forth.
When parameters are not supplied, they should default to something reasonable. For example, if no Kafka log directories are specified, we create a single Kafka log directory for each broker. When broker ids are not specified, we default to automatic ID assignment through ZooKeeper.
Tests can shut down brokers or zookepeer nodes as part of the test by invoking
shutdownon the relevant Java object. They services can be restarted by callingstart.During cluster startup and shutdown, we parallelize operations that take a long time, like starting a broker or shutting down a broker. This cuts test times.
This is a rough sketch that doesn't include clients or SSL / SASL.