This is an automated email from the ASF dual-hosted git repository.
kfaraz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 7c0ed7c51e4 Migrate KafkaSchemaRegistryResource to redpanda as
underlying implementation (#18469)
7c0ed7c51e4 is described below
commit 7c0ed7c51e43f1ce609be6ea97e86d5007073ba6
Author: Lucas Capistrant <[email protected]>
AuthorDate: Wed Sep 3 06:42:25 2025 -0500
Migrate KafkaSchemaRegistryResource to redpanda as underlying
implementation (#18469)
Changes:
- Do not use `confluentinc/cp-schema-registry` as it is very large and
causes timeouts while downloading
- Use redpanda Testcontainer in `KafkaSchemaRegistryResource`
- Redpanda has a confluent compliant schema registry API
---
embedded-tests/pom.xml | 6 ++++++
.../indexing/KafkaSchemaRegistryResource.java | 24 +++++++++++-----------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/embedded-tests/pom.xml b/embedded-tests/pom.xml
index 40a96de8798..aa137005207 100644
--- a/embedded-tests/pom.xml
+++ b/embedded-tests/pom.xml
@@ -359,6 +359,12 @@
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>redpanda</artifactId>
+ <version>${testcontainers.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
diff --git
a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/KafkaSchemaRegistryResource.java
b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/KafkaSchemaRegistryResource.java
index 8e1649962cc..3583eeb5557 100644
---
a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/KafkaSchemaRegistryResource.java
+++
b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/KafkaSchemaRegistryResource.java
@@ -23,14 +23,18 @@ import
org.apache.druid.indexing.kafka.simulate.KafkaResource;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.testing.embedded.EmbeddedDruidCluster;
import org.apache.druid.testing.embedded.TestcontainerResource;
-import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.redpanda.RedpandaContainer;
/**
* A resource for managing a Schema Registry instance in embedded tests.
+ * <p>
+ * Uses Redpanda testcontainers under the hood which offers built in schema
registry support that is confluent
+ * compatible while having a much smaller image size than the official
confluent schema registry image.
*/
-public class KafkaSchemaRegistryResource extends
TestcontainerResource<GenericContainer<?>>
+public class KafkaSchemaRegistryResource extends
TestcontainerResource<RedpandaContainer>
{
- private static final String SCHEMA_REGISTRY_IMAGE =
"confluentinc/cp-schema-registry:latest";
+ private static final String SCHEMA_REGISTRY_IMAGE =
"docker.redpanda.com/redpandadata/redpanda:v25.2.2";
+ private static final int SCHEMA_REGISTRY_PORT = 8081;
private final KafkaResource kafkaResource;
private String connectURI;
@@ -43,14 +47,10 @@ public class KafkaSchemaRegistryResource extends
TestcontainerResource<GenericCo
}
@Override
- protected GenericContainer<?> createContainer()
+ protected RedpandaContainer createContainer()
{
- return new GenericContainer<>(SCHEMA_REGISTRY_IMAGE)
- .dependsOn(kafkaResource.getContainer())
- .withExposedPorts(9081)
- .withEnv("SCHEMA_REGISTRY_HOST_NAME", "schema-registry")
- .withEnv("SCHEMA_REGISTRY_LISTENERS", "http://0.0.0.0:9081")
- .withEnv("SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS",
kafkaResource.getBootstrapServerUrl());
+ return new RedpandaContainer(SCHEMA_REGISTRY_IMAGE)
+ .dependsOn(kafkaResource.getContainer());
}
@Override
@@ -66,7 +66,7 @@ public class KafkaSchemaRegistryResource extends
TestcontainerResource<GenericCo
return StringUtils.format(
"%s:%d",
embeddedHostname,
- getContainer().getMappedPort(9081)
+ getContainer().getMappedPort(SCHEMA_REGISTRY_PORT)
);
}
@@ -82,7 +82,7 @@ public class KafkaSchemaRegistryResource extends
TestcontainerResource<GenericCo
return StringUtils.format(
"http://%s:%d",
cluster.getEmbeddedHostname(),
- getContainer().getMappedPort(9081)
+ getContainer().getMappedPort(SCHEMA_REGISTRY_PORT)
);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]