Redpanda
Install
| npm install @testcontainers/redpanda --save-dev
|
Examples
These examples use the following libraries:
Choose an image from the container registry and substitute IMAGE
.
Produce/consume a message
Connect to schema registry
| await using container = await new RedpandaContainer(IMAGE).start();
const schemaRegistryUrl = container.getSchemaRegistryAddress();
const response = await fetch(`${schemaRegistryUrl}/subjects`, {
method: "GET",
headers: {
"Content-Type": "application/vnd.schemaregistry.v1+json",
},
});
expect(response.status).toBe(200);
|
Connect to admin
| await using container = await new RedpandaContainer(IMAGE).start();
const adminUrl = `${container.getAdminAddress()}/v1`;
const response = await fetch(adminUrl);
expect(response.status).toBe(200);
|
Connect to REST proxy
| await using container = await new RedpandaContainer(IMAGE).start();
const restProxyUrl = `${container.getRestProxyAddress()}/topics`;
const response = await fetch(restProxyUrl);
expect(response.status).toBe(200);
|