Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import org.awaitility.Awaitility;
import org.junit.Test;
import org.testcontainers.AbstractKafka;
import org.testcontainers.KCatContainer;
import org.testcontainers.Testcontainers;
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

Expand Down Expand Up @@ -195,13 +195,7 @@ public void testUsageWithListener() throws Exception {
.withNetwork(network);
// }
// createKCatContainer {
GenericContainer<?> kcat = new GenericContainer<>("confluentinc/cp-kcat:7.9.0")
.withCreateContainerCmdModifier(cmd -> {
cmd.withEntrypoint("sh");
})
.withCopyToContainer(Transferable.of("Message produced by kcat"), "/data/msgs.txt")
.withNetwork(network)
.withCommand("-c", "tail -f /dev/null")
KCatContainer kcat = new KCatContainer().withNetwork(network)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this is part of the documentation. So, we should keep it as is.

// }
) {
kafka.start();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.testcontainers.redpanda;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.images.builder.Transferable;

public class KCatContainer extends GenericContainer<KCatContainer> {

public KCatContainer() {
super("confluentinc/cp-kcat:7.9.0");
withCreateContainerCmdModifier(cmd -> {
cmd.withEntrypoint("sh");
});
withCopyToContainer(Transferable.of("Message produced by kcat"), "/data/msgs.txt");
withCommand("-c", "tail -f /dev/null");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
import org.apache.kafka.common.errors.TopicAuthorizationException;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.SocatContainer;
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.utility.DockerImageName;

import java.util.Collection;
Expand Down Expand Up @@ -111,13 +109,7 @@ public void testUsageWithListener() throws Exception {
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
.withListener(() -> "redpanda:19092")
.withNetwork(network);
GenericContainer<?> kcat = new GenericContainer<>("confluentinc/cp-kcat:7.9.0")
.withCreateContainerCmdModifier(cmd -> {
cmd.withEntrypoint("sh");
})
.withCopyToContainer(Transferable.of("Message produced by kcat"), "/data/msgs.txt")
.withNetwork(network)
.withCommand("-c", "tail -f /dev/null")
KCatContainer kcat = new KCatContainer().withNetwork(network)
) {
redpanda.start();
kcat.start();
Expand All @@ -141,13 +133,7 @@ public void testUsageWithListenerInTheSameNetwork() throws Exception {
.withNetwork(network);
// }
// createKCatContainer {
GenericContainer<?> kcat = new GenericContainer<>("confluentinc/cp-kcat:7.9.0")
.withCreateContainerCmdModifier(cmd -> {
cmd.withEntrypoint("sh");
})
.withCopyToContainer(Transferable.of("Message produced by kcat"), "/data/msgs.txt")
.withNetwork(network)
.withCommand("-c", "tail -f /dev/null")
KCatContainer kcat = new KCatContainer().withNetwork(network)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

// }
) {
kafka.start();
Expand Down Expand Up @@ -200,13 +186,7 @@ public void testUsageWithListenerAndSasl() throws Exception {
.withSuperuser("panda")
.withListener("my-panda:29092")
.withNetwork(network);
GenericContainer<?> kcat = new GenericContainer<>("confluentinc/cp-kcat:7.9.0")
.withCreateContainerCmdModifier(cmd -> {
cmd.withEntrypoint("sh");
})
.withCopyToContainer(Transferable.of("Message produced by kcat"), "/data/msgs.txt")
.withNetwork(network)
.withCommand("-c", "tail -f /dev/null")
KCatContainer kcat = new KCatContainer().withNetwork(network)
) {
redpanda.start();

Expand Down
Loading