capistrant commented on code in PR #18383:
URL: https://github.com/apache/druid/pull/18383#discussion_r2265488700


##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/SchemaRegistryResource.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.testing.embedded.indexing;
+
+import org.apache.druid.testing.embedded.TestcontainerResource;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.kafka.KafkaContainer;
+
+/**
+ * A resource for managing a Schema Registry instance in embedded tests.
+ * This class extends TestcontainerResource to provide a Schema Registry 
container.
+ * Confluent schema registry is commonly used for managing schemas in 
Kafka-based applications but not
+ * natively supported by testcontainers.
+ */
+public class SchemaRegistryResource extends 
TestcontainerResource<GenericContainer<?>>
+{
+  private static final String SCHEMA_REGISTRY_IMAGE = 
"confluentinc/cp-schema-registry:latest";
+
+  KafkaContainer kafkaContainer;
+
+  @Override
+  protected GenericContainer<?> createContainer()
+  {
+    return new GenericContainer<>(SCHEMA_REGISTRY_IMAGE)
+        .dependsOn(kafkaContainer)
+        .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", 
kafkaContainer.getBootstrapServers());

Review Comment:
   Do you think there is risk of startup issues removing the dependency? 
`dependsOn(kafkaContainer)` uses testcontainers api to not start the schema 
registry until Kafka has has started, making sure that schema registry won't 
error out if it starts up before the Kafka container is up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to