KAFKA-3612: Added structure for integration tests#1260
Conversation
|
@dguy @ijuma @guozhangwang @miguno please have a look if you can. |
| zkclient: "0.8", | ||
| zookeeper: "3.4.6", | ||
| curator: "2.9.0", | ||
| assertj: "3.3.0", |
| /** | ||
| * Runs an in-memory, "embedded" Kafka cluster with 1 ZooKeeper instance and 1 Kafka broker. | ||
| */ | ||
| public class EmbeddedSingleNodeKafkaCluster { |
There was a problem hiding this comment.
I'd consider making this extend org.junit.rules.ExternalResource - it can then be used as a JUnit ClassRule or Rule. The benefits being that the JUnit framework takes care of startup and shutdown
There was a problem hiding this comment.
That's a good idea.
Note: Kafka does not use this JUnit functionality yet (i.e. no use of ExternalResource, ClassRule, Rule as far as I can tell). @ijuma: Would it ok for us to introduce this? There's no additional dependency etc., it's just using a new JUnit feature that was introduced in 4.7 (we're on 4.12).
There was a problem hiding this comment.
Yes, it's fine to use that, I think. @guozhangwang is using TemporaryFolder in his PR, for example. However, when I looked at the TemporaryFolder implementation, the implementation is not great, see my comment here: #1258 (comment)
|
Thanks for your feedback, @dguy! |
| public void start() { | ||
| log.debug("Starting embedded Kafka broker at {} (with log.dirs={} and ZK ensemble at {}) ...", | ||
| brokerList(), logDir, zookeeperConnect()); | ||
| // already started in constructore |
There was a problem hiding this comment.
Typo -- or is that Italian? :-)
|
@miguno I brought in one more utility method (borrowed from you), as well as swapped the stores test, which is not great, with the one that tests compact topics which is a better starting point. |
| /** | ||
| * Tests related to internal topics in streams | ||
| * | ||
| * Note: This example uses lambda expressions and thus works with Java 8+ only. |
There was a problem hiding this comment.
This code doesn't use lambdas (anymore), so I'd remove this comment.
No description provided.