Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Redpanda testcontainers with Apache Kafka native #905

Merged
merged 1 commit into from
Sep 13, 2024
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>redpanda</artifactId>
<artifactId>kafka</artifactId>
<version>${lib.testcontainers.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -801,7 +801,7 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>redpanda</artifactId>
<artifactId>kafka</artifactId>
<version>${lib.testcontainers.version}</version>
<scope>compile</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dependencytrack/common/ConfigKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public enum ConfigKey implements Config.Key {

DEV_SERVICES_ENABLED("dev.services.enabled", false),
DEV_SERVICES_IMAGE_FRONTEND("dev.services.image.frontend", "ghcr.io/dependencytrack/hyades-frontend:snapshot"),
DEV_SERVICES_IMAGE_KAFKA("dev.services.image.kafka", "docker.redpanda.com/vectorized/redpanda:v24.2.4"),
DEV_SERVICES_IMAGE_KAFKA("dev.services.image.kafka", "apache/kafka-native:3.8.0"),
DEV_SERVICES_IMAGE_POSTGRES("dev.services.image.postgres", "postgres:16");

private final String propertyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public void contextInitialized(final ServletContextEvent event) {
final Constructor<?> postgresContainerConstructor = postgresContainerClass.getDeclaredConstructor(String.class);
postgresContainer = (AutoCloseable) postgresContainerConstructor.newInstance(getProperty(DEV_SERVICES_IMAGE_POSTGRES));

// TODO: Detect when Apache Kafka is requested vs. when Redpanda is requested,
// TODO: Detect when Apache Kafka is requested vs. when Kafka is requested,
// and pick the corresponding Testcontainers class accordingly.
final Class<?> kafkaContainerClass = Class.forName("org.testcontainers.redpanda.RedpandaContainer");
final Class<?> kafkaContainerClass = Class.forName("org.testcontainers.kafka.KafkaContainer");
final Constructor<?> kafkaContainerConstructor = kafkaContainerClass.getDeclaredConstructor(String.class);
kafkaContainer = (AutoCloseable) kafkaContainerConstructor.newInstance(getProperty(DEV_SERVICES_IMAGE_KAFKA));

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ dev.services.image.frontend=ghcr.io/dependencytrack/hyades-frontend:snapshot
#
# @category: Development
# @type: string
dev.services.image.kafka=docker.redpanda.com/vectorized/redpanda:v24.2.4
dev.services.image.kafka=apache/kafka-native:3.8.0

# The image to use for the PostgreSQL dev services container.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.testcontainers.redpanda.RedpandaContainer;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.kafka.KafkaContainer;

import java.time.Duration;
import java.util.List;
Expand All @@ -60,8 +59,7 @@
public class ProcessorManagerTest {

@Rule
public RedpandaContainer kafkaContainer = new RedpandaContainer(DockerImageName
.parse("docker.redpanda.com/vectorized/redpanda:v24.2.4"));
public KafkaContainer kafkaContainer = new KafkaContainer("apache/kafka-native:3.8.0");

private AdminClient adminClient;
private Producer<String, String> producer;
Expand Down
Loading