TestContainers Kafka cleanup

Viewed 550

I'm using TestContainers with Kafka, but I'm getting come cache on my tests.

I have built the Hello World Kafka Stream application, and on my tests, I'm getting the answer:

Flat Map: Hello World!
Grouping: key=null work=hello
Grouping: key=null work=world
Key=hello value=7

My test is very simple, I'm creating the KafkaContainer and sending a message to the input topic, and checking the output topic.

@Container
public static KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.4.3"));

My question is: how can I clean up all Kafka data (or all container data)? Can I do it between tests?

I believe that every time I run the tests I need to use a brand new Kafka Cluster, not the old one. I create a GitHub repository with my test.

1 Answers

It was not a TestContainer problem.

Kafka Streams creates a local cache on %AppData%\Local\Temp\kafka-streams

Related