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
.
Create a Redpanda
to use it in your tests:
Creating a Redpanda inside_block:constructorWithVersion
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:
Bootstrap Servers inside_block:getBootstrapServers
Redpanda also provides a schema registry implementation. Like the Redpanda broker, you can access by using the following schema registry location:
Schema Registry inside_block:getSchemaRegistryAddress
Add the following dependency to your pom.xml
/build.gradle
file:
=== "Gradle"
testImplementation "org.testcontainers:redpanda:{{latest_version}}"
=== "Maven"
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>redpanda</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>