Skip to content

Instantly share code, notes, and snippets.

@schroedermatt
Created November 11, 2021 17:09
Show Gist options
  • Save schroedermatt/589c87e6d9766308b7fd046847ed1630 to your computer and use it in GitHub Desktop.
Save schroedermatt/589c87e6d9766308b7fd046847ed1630 to your computer and use it in GitHub Desktop.
Dockerized Quarkus Test Resource
public class ContainerKafkaTestResource implements QuarkusTestResourceLifecycleManager {
private static final KafkaContainer kafka = new KafkaContainer();
/**
* @return A map of system properties that should be set for the running tests
*/
@Override
public Map<String, String> start() {
kafka.start();
Map<String, String> systemProperties = new HashMap<>();
systemProperties.put("kafka.bootstrap.servers", kafka.getBootstrapServers());
systemProperties.put("quarkus.kafka-streams.bootstrap-servers", kafka.getBootstrapServers());
return systemProperties;
}
@Override
public void stop() {
kafka.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment