testcontainers / testcontainers/testcontainers-java
Support for Kafka Schema registry
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
I use the Kafka test container which work really well. The only issue that I have is that I use protobuf/avro encoding for my messages. This means I need to run the schema registry container.
Would it be possible to provide the schema registry out of the box and document it in the docs ? I'm willing to create a PR but I prefer to ask first.
See below the definition that I use in my unit test:
public class SchemaRegistryContainer extends GenericContainer<SchemaRegistryContainer> {
public SchemaRegistryContainer() {
this("5.5.1");
}
public SchemaRegistryContainer(String version) {
super("confluentinc/cp-schema-registry:" + version);
withExposedPorts(8081);
}
public SchemaRegistryContainer withKafka(KafkaContainer kafka) {
withEnv("SCHEMA_REGISTRY_HOST_NAME", "schema-registry");
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://0.0.0.0:8081");
withEnv(
"SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS",
"PLAINTEXT://" + kafka.getNetworkAliases().get(0) + ":9092");
return self();
}
public String getSchemaRegistryUrl() {
return "http://" + getContainerIpAddress() + ":" + getMappedPort(8081);
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the KafkaContainer and GenericContainer entry points, then compare the issue's SchemaRegistryContainer example with the project's existing container modules. Done means schema registry support is available for Kafka tests and its usage is documented for protobuf or Avro messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, kafka
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100