Skip to content

Redpanda

Testcontainers can be used to automatically instantiate and manage Redpanda containers. More precisely Testcontainers uses the official Docker images for Redpanda

Note

This module uses features provided in docker.redpanda.com/vectorized/redpanda.

Example

Create a Redpanda to use it in your tests:

RedpandaContainer container = new RedpandaContainer("docker.redpanda.com/vectorized/redpanda:v22.2.1")

Now your tests or any other process running on your machine can get access to running Redpanda broker by using the following bootstrap server location:

container.getBootstrapServers()

Redpanda also provides a schema registry implementation. Like the Redpanda broker, you can access by using the following schema registry location:

container.getSchemaRegistryAddress()

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:redpanda:1.17.6"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>redpanda</artifactId>
    <version>1.17.6</version>
    <scope>test</scope>
</dependency>