[FEATURE] Add Microcks Acceptance Test Suite for Kafka Client Template
Why do we need this improvement?
As per the generator guidelines in packages/README.md (Principle 11):
"A template is considered to be of a good quality and ready for use if it has acceptance tests configured using Microcks that provides both mocks and runtime support. Example implementation available in tests for websocket"
Currently:
- The WebSocket client templates have a comprehensive acceptance test suite under
packages/templates/clients/websocket/test/that verifies generated clients (JavaScript, Python, Dart, Java) against mock servers in containers. - The Kafka client template under
packages/templates/clients/kafka/only has snapshot-based integration tests (test/integration-test/).
Snapshot tests only check that the generated text files match previous output; they do not verify that the generated Java Quarkus client compiles, connects over the network, or successfully publishes and consumes Kafka records. Without runtime tests against a mock broker, we cannot guarantee the generated Kafka code works as expected.
How will this change help?
- Runtime Verification: Guarantees that the generated Java Quarkus Kafka client connects to a broker, handles serializers/deserializers properly, and exchanges messages as defined in the AsyncAPI specification.
- Prevents Regressions: Automatically catches breaking changes in template generation logic before PRs are merged.
- Adheres to Repo Principles: Brings the Kafka template into full compliance with Principle 11 in
packages/README.md. - No Host Setup Required: The entire test suite runs inside standard Docker/Podman containers (
maven:3.9-eclipse-temurin-21andredpanda), meaning contributors and CI do not need Java, Maven, or Kafka installed on the host machine.
Screenshots
Local test execution log showing clean containerized execution:
kafka-acceptance-tester-java | [INFO] --- quarkus:3.25.2:build (default) @ quarkus-kafka ---
kafka-acceptance-tester-java | [INFO] [io.sma.rea.mes.kafka] Connected to Kafka brokers 'kafka:19092', configured to write records to 'adeo-dev-case-study-COSTING-RESPONSE-V1'
kafka-acceptance-tester-java | [INFO] [io.sma.rea.mes.kafka] Connected to Kafka brokers 'kafka:19092', configured to poll records from [adeo-dev-case-study-COSTING-REQUEST-V1]
kafka-acceptance-tester-java | [INFO] [io.quarkus] kafka-acceptance-tests started in 2.971s. Listening on: http://localhost:8081
kafka-acceptance-tester-java | [INFO] [com.asyncapi.CostingResponseProducer] Sent costing request with ID: req-acceptance-test-123
kafka-acceptance-tester-java | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
kafka-acceptance-tester-java | [INFO] BUILD SUCCESS
kafka-acceptance-tester-java exited with code 0
How could it be implemented/designed?
Following the established architecture from packages/templates/clients/websocket/test/:
-
Infrastructure (
packages/templates/clients/kafka/test/microcks-setup/):microcks-podman.yml: Compose file running:redpanda: Lightweight Kafka broker (docker.io/redpandadata/redpanda:v24.3.1) exposed on ports 9092 and 19092.mongo: Microcks datastore (docker.io/mongo:4.4.29).microcks: Microcks core server (quay.io/microcks/microcks:1.11.2).microcks-async-minion: Asynchronous mock engine (quay.io/microcks/microcks-async-minion:1.11.2) connected to Redpanda viaKAFKA_BOOTSTRAP_SERVER: kafka:19092.importer: Microcks CLI container to automatically load__fixtures__/asyncapi-adeo.ymlon startup.
checkMicrocksReady.sh: Health check script that polls/api/healthbefore test invocation (supporting both Docker and Podman).README.md: Clear instructions for local execution and debugging.
-
Acceptance Test Suite (
packages/templates/clients/kafka/test/java/quarkus/):pom.xml: Test runner project depending on the generatedquarkus-kafkaartifact.application.properties: Configures Quarkus ArC dependency indexing (quarkus.index-dependency.quarkus-kafka.group-id=com.asyncapi) so the generated Producer and Consumer beans are automatically discovered by CDI.KafkaAcceptanceTest.java:@QuarkusTestclass that tests the generatedCostingResponseProducerandCostingRequestConsumerbeans and verifies message transmission against the broker.
-
Performance Optimization:
- Mounts a named
maven-cachevolume in the test container so dependencies are cached across runs, keeping test execution under ~10 seconds.
- Mounts a named
Questions for Maintainers:
- Should we name the compose file
microcks-podman.ymlto match the WebSocket convention, or would you prefermicrocks-docker.yml? - For CI integration, would you like this added as a separate job in
.github/workflows/pr-testing-with-test-project.ymlalongside the WebSocket acceptance matrix?
🚧 Breaking changes
No
👀 Have you checked for similar open issues?
- [x] I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- [x] I have read the Contributing Guidelines
Are you willing to work on this issue?
Yes I am willing to submit a PR!
@dosu What do you think about this Feature proposal?
This looks like a worthwhile addition: it directly addresses Principle 11’s requirement for Microcks-backed acceptance tests, while complementing rather than replacing the required integration tests. [1]
For your two questions, my recommendations, rather than maintainer decisions, are:
- Keep
microcks-podman.ymlfor consistency. The WebSocket suite already uses that name, and CI invokes it withdocker compose, so the filename does not imply Podman-only support. [2] - Add a separate Kafka acceptance job in the same workflow. The existing acceptance matrix varies only by language and hardcodes WebSocket fixture paths, setup, and working directories. A separate job would avoid mixing protocol-specific setup into that matrix. [2]
I’d make the acceptance criteria explicit:
- Build the freshly generated artifact and test that artifact, following the existing WebSocket Java runner’s
mvn clean installfollowed by the test project. [3] - Assert actual payload delivery through both generated producer and consumer paths, not just successful startup or broker connections.
- Make Microcks participate in the assertions. If the tests only exchange records with Redpanda, they demonstrate broker integration but not the Microcks-backed contract coverage the proposal targets. Principle 11 explicitly calls for Microcks mocks and runtime support. [1]
- Ensure CI propagates the test runner’s failure status and captures container logs.
The Maven cache is a sensible optimization, but I’d present “under 10 seconds” as a measured warm-cache result, not an acceptance requirement.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
@dosu
The Maven cache is a sensible optimization, but I’d present “under 10 seconds” as a measured warm-cache result, not an acceptance requirement.
elaborate
The organization that owns this space has reached its limit of 200 credits per month. Usage will reset on 2026-11-01. Please contact an owner or admin of that organization to upgrade its plan. Upgrading a different organization will not change this space's limit.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
Okay, saw the credit limit :(
For the time being I've decided to move forward with these:
- Keep
microcks-podman.ymlfor repo consistency. - Add a separate CI job for Kafka acceptance tests rather than touching the WebSocket matrix.
- Treat 10s as a warm-cache benchmark rather than a strict requirement.
- Have the consumer assert the actual mock contract payloads from Microcks Async Minion.
The closed PR above was deliberately raised to check CI result but it was automatically closed by asyncapi-bot cuz issue wasn't approved. Please don't mind it :)
I've built the working prototype of this kafka microcks acceptance suite and verified it e2e in CI on my fork, please have a look: PR: https://github.com/devxdh/asyncapi-generator/pull/2 CI Job: https://github.com/devxdh/asyncapi-generator/actions/runs/39462848506/job/118767228659?pr=2
It sets up Redpanda + Microcks in Docker, builds the generated Quarkus client, and verifies broker connectivity and schema validation. All checks passed cleanly.
cc @Adi-204 in case you'd like to take a look when you have a moment. Just sharing this here in case it helps with evaluating the proposal.
Okay, saw the credit limit :(
For the time being I've decided to move forward with these:
- Keep
microcks-podman.ymlfor repo consistency.- Add a separate CI job for Kafka acceptance tests rather than touching the WebSocket matrix.
- Treat 10s as a warm-cache benchmark rather than a strict requirement.
- Have the consumer assert the actual mock contract payloads from Microcks Async Minion.
You can run all the all tests locally ,refer contribution.md for commands
/approve
👋 Thanks for your patience. This issue has been reviewed and is ready to be worked on.
Before you start:
- Comment below to let others know you're working on it (avoids duplicate work)
- Read our CONTRIBUTING.md if you haven't already
- Fork the repo, create a feature branch, and open a draft PR early
Approved by @Adi-204