Library | Version | Documentation | Vulnerability |
---|---|---|---|
schemaregistry-junit5 | |||
schemaregistry-junit4 | |||
schemaregistry-junit-core |
Are you tired of waiting for Docker containers to fire up while testing your Kafka solution? Or are you tired of waiting for an ephemeral environment to start? Are you looking for a solution to reduce the time you are loosing waiting for Apache Kafka Cluster and Confluent Schema Registry to start while testing? schemaregistry-junit is the answer! By pairing schemaregistry-junit together with kafka-junit, you can speed up your tests and shorten the feedback loop by reducing the time wasted waiting for Docker containers or ephemeral environments to start. schemaregistry-junit lets you run a fully working Confluent Schema Registry in-memory. The server lifecycle is fully automated via JUnit extensions. A fluent DSL is provided to configure the Confluent Schema Registry.
This project was inspired by kafka-junit.
- Support for JUnit 4 and JUnit 5
- Support all Confluent SchemaRegistry version from 4.0.0 to the latest
The easiest way to include schemaregistry-junit
in your project(s) is via Maven dependency. Binary, Sources
and Javadocs are all available in
Maven Central.
For JUnit 5
Maven
<!-- Declare schemaregistry-junit5 dependency -->
<dependency>
<groupId>io.github.data-rocks-team</groupId>
<artifactId>schemaregistry-junit5</artifactId>
<version>0.1.1</version>
</dependency>
<!-- Include Confluent Schema-Registry -->
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry</artifactId>
<version>X.X.X</version>
</dependency>
Gradle
testImplementation 'io.github.data-rocks-team:schemaregistry-junit5:0.1.1'
testImplementation 'io.confluent:kafka-schema-registry:X.X.X'
For JUnit 4
Maven
<!-- Declare schemaregistry-junit5 dependency -->
<dependency>
<groupId>io.github.data-rocks-team</groupId>
<artifactId>schemaregistry-junit4</artifactId>
<version>0.1.1</version>
</dependency>
<!-- Include Confluent Schema-Registry -->
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry</artifactId>
<version>X.X.X</version>
</dependency>
Gradle
testImplementation 'io.github.data-rocks-team:schemaregistry-junit4:0.1.1'
testImplementation 'io.confluent:kafka-schema-registry:X.X.X'
Given a class using SharedSchemaRegistryTestResource
, before all tests start,
JUnit calls the start function. This function replicates the behaviour
of SchemaRegistryMain.java,
which first validates the settings and then starts the server. When all tests have been executed,
independently of the test results, JUnit calls the shutdown function, which will shut the server
down.
Logs generated by the server are redirected to the terminal.
Confluent Version | Regression test |
---|---|
4.x.x | |
5.x.x | |
6.x.x | |
7.x.x |
Every build is automatically tested against the latest patch version of every minor version since 4.0.0. For more details, check regression-test.
Before compiling any example, run ./gradlew setDependenciesForRegressionTesting
in the main
project. This gradle task will ensure that the regression tests will use the same dependency
versions used in the main project. To ensure that setDependenciesForExample
works as expected,
dependencies version should be defined in the ext {}
section in the
main build.gradle and the example project should define versions as
nameOfTheDependencyVersion = PLACEHOLDER
(see
regression-test/build.gradle).
Upon bumping a major or minor version of io.confluent:kafka-schema-registry
, a new regression test
should be added under regression-test.
Before compiling any example, run ./gradlew setDependenciesForExample
in the main project. This
gradle task will ensure that the example project will use the same dependency versions used in the
main project. To ensure that setDependenciesForExample
works as expected, dependencies
version should be defined in the ext {}
section in the main build.gradle and the
example project should define versions as nameOfTheDependencyVersion = PLACEHOLDER
(an example
can be found here).
Found a bug? You've got an awesome feature you want to add? We welcome contributions!
Any questions or suggestions? Get in touch!
MIT view license