Skip to content
Merged
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
8 changes: 8 additions & 0 deletions modules/redpanda/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ dependencies {
api project(':testcontainers')
shaded 'org.freemarker:freemarker:2.3.34'

testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'

testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.13.4'
testImplementation 'org.apache.kafka:kafka-clients:4.0.0'
testImplementation 'org.assertj:assertj-core:3.27.4'
testImplementation 'io.rest-assured:rest-assured:5.5.6'
testImplementation 'org.awaitility:awaitility:4.3.0'
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
package org.testcontainers.redpanda;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

@RunWith(Parameterized.class)
public class CompatibleImageTest extends AbstractRedpanda {
class CompatibleImageTest extends AbstractRedpanda {

private final String image;

public CompatibleImageTest(String image) {
this.image = image;
}

@Parameterized.Parameters(name = "{0}")
public static String[] image() {
return new String[] { "docker.redpanda.com/redpandadata/redpanda:v22.2.1", "redpandadata/redpanda:v22.2.1" };
}

@Test
public void shouldProduceAndConsumeMessage() throws Exception {
try (RedpandaContainer container = new RedpandaContainer(this.image)) {
@ParameterizedTest
@MethodSource("image")
void shouldProduceAndConsumeMessage(String image) throws Exception {
try (RedpandaContainer container = new RedpandaContainer(image)) {
container.start();
testKafkaFunctionality(container.getBootstrapServers());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.apache.kafka.common.errors.SaslAuthenticationException;
import org.apache.kafka.common.errors.TopicAuthorizationException;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.SocatContainer;
Expand All @@ -30,22 +30,22 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class RedpandaContainerTest extends AbstractRedpanda {
class RedpandaContainerTest extends AbstractRedpanda {

private static final String REDPANDA_IMAGE = "docker.redpanda.com/redpandadata/redpanda:v22.2.1";

private static final DockerImageName REDPANDA_DOCKER_IMAGE = DockerImageName.parse(REDPANDA_IMAGE);

@Test
public void testUsage() throws Exception {
void testUsage() throws Exception {
try (RedpandaContainer container = new RedpandaContainer(REDPANDA_DOCKER_IMAGE)) {
container.start();
testKafkaFunctionality(container.getBootstrapServers());
}
}

@Test
public void testUsageWithStringImage() throws Exception {
void testUsageWithStringImage() throws Exception {
try (
// constructorWithVersion {
RedpandaContainer container = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.2")
Expand All @@ -61,21 +61,21 @@ public void testUsageWithStringImage() throws Exception {
}

@Test
public void testNotCompatibleVersion() {
void testNotCompatibleVersion() {
assertThatThrownBy(() -> new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v21.11.19"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Redpanda version must be >= v22.2.1");
}

@Test
public void redpandadataRedpandaImageVersion2221ShouldNotBeCompatible() {
void redpandadataRedpandaImageVersion2221ShouldNotBeCompatible() {
assertThatThrownBy(() -> new RedpandaContainer("redpandadata/redpanda:v21.11.19"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Redpanda version must be >= v22.2.1");
}

@Test
public void testSchemaRegistry() {
void testSchemaRegistry() {
try (RedpandaContainer container = new RedpandaContainer(REDPANDA_DOCKER_IMAGE)) {
container.start();

Expand Down Expand Up @@ -105,7 +105,7 @@ public void testSchemaRegistry() {
}

@Test
public void testUsageWithListener() throws Exception {
void testUsageWithListener() throws Exception {
try (
Network network = Network.newNetwork();
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
Expand All @@ -132,7 +132,7 @@ public void testUsageWithListener() throws Exception {
}

@Test
public void testUsageWithListenerInTheSameNetwork() throws Exception {
void testUsageWithListenerInTheSameNetwork() throws Exception {
try (
Network network = Network.newNetwork();
// registerListener {
Expand Down Expand Up @@ -165,7 +165,7 @@ public void testUsageWithListenerInTheSameNetwork() throws Exception {
}

@Test
public void testUsageWithListenerFromProxy() throws Exception {
void testUsageWithListenerFromProxy() throws Exception {
try (
Network network = Network.newNetwork();
// createProxy {
Expand All @@ -187,7 +187,7 @@ public void testUsageWithListenerFromProxy() throws Exception {
}

@Test
public void testUsageWithListenerAndSasl() throws Exception {
void testUsageWithListenerAndSasl() throws Exception {
final String username = "panda";
final String password = "pandapass";
final String algorithm = "SCRAM-SHA-256";
Expand Down Expand Up @@ -266,7 +266,7 @@ public void testUsageWithListenerAndSasl() throws Exception {

@SneakyThrows
@Test
public void enableSaslWithSuccessfulTopicCreation() {
void enableSaslWithSuccessfulTopicCreation() {
try (
// security {
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
Expand All @@ -289,7 +289,7 @@ public void enableSaslWithSuccessfulTopicCreation() {
}

@Test
public void enableSaslWithUnsuccessfulTopicCreation() {
void enableSaslWithUnsuccessfulTopicCreation() {
try (
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
.enableAuthorization()
Expand All @@ -313,7 +313,7 @@ public void enableSaslWithUnsuccessfulTopicCreation() {
}

@Test
public void enableSaslAndWithAuthenticationError() {
void enableSaslAndWithAuthenticationError() {
try (
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
.enableAuthorization()
Expand All @@ -335,7 +335,7 @@ public void enableSaslAndWithAuthenticationError() {
}

@Test
public void schemaRegistryWithHttpBasic() {
void schemaRegistryWithHttpBasic() {
try (
RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")
.enableSchemaRegistryHttpBasicAuth()
Expand All @@ -362,7 +362,7 @@ public void schemaRegistryWithHttpBasic() {

@SneakyThrows
@Test
public void testRestProxy() {
void testRestProxy() {
try (RedpandaContainer redpanda = new RedpandaContainer("docker.redpanda.com/redpandadata/redpanda:v23.1.7")) {
redpanda.start();

Expand Down
Loading