AsyncAPI 3.x: the sampler - #1752
Open
LautaroPetaccio wants to merge 4 commits into
Open
LautaroPetaccio wants to merge 4 commits into
LautaroPetaccio wants to merge 4 commits into
Conversation
LautaroPetaccio
added this pull request to stack #1712
September 13, 2026 19:50
LautaroPetaccio
force-pushed
the
feature/asyncapi-sampler
branch
from
September 13, 2026 20:42
5cf2171 to
6d8dd8c
Compare
LautaroPetaccio
marked this pull request as ready for review
September 13, 2026 21:31
arcuri82
force-pushed
the
feature/asyncapi-sampler
branch
from
September 14, 2026 10:51
d676d16 to
c3c1979
Compare
AsyncApiSampler asks the driver where the document is, reads it, builds one action per publishable message, and samples sequences of them. The first individuals it hands out publish one message each, one per operation, so every operation is tried before the search starts combining them. One sampler for both modes. Where REST and GraphQL fetch the schema themselves in black-box mode, here the document comes through the driver either way, as the driver is what holds the connection to the broker. Seeded test cases are not supported yet, and say so.
Review: what the parser skips was reported to the user and kept for the final report, but nothing checked it; nor that the single-message individuals return after a reset, nor the two other ways start-up can fail. Four tests, and the helper that builds the injector is shared.
Four TODOs, where someone will next look: no AsyncAPI-specific smart strategy yet, message examples parsed but unused, no seeding format, and a method shared verbatim with the REST sampler.
LautaroPetaccio
force-pushed
the
feature/asyncapi-sampler
branch
from
September 14, 2026 12:38
c3c1979 to
bc02956
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eleventh in the AsyncAPI stack, on top of #1751. The fitness and the Guice module that make
--problemType ASYNCAPIrun come next.What it does
At start-up,
AsyncApiSamplerasks the driver where the document is, reads it — from a location or as text, whicheverAsyncApiProblemcarried — hands it toAsyncApiActionBuilder, and ends up with one action template per publishable message. Whatever the parser or the builder had to skip is printed for the user and kept in theWarningsAggregatorfor the final report, as the REST sampler does.Sampling is the plain kind: a random individual publishes between one and
maxTestSizemessages, each a copy of a template with its genes initialised. With smart sampling on, the first individuals handed out publish one message each, one per operation, so that every operation has been tried once before the search starts combining them — the same opening move as REST's ad-hoc individuals.One sampler for both modes
REST and GraphQL have an
initForBlackBoxbranch that fetches the schema themselves, because in black-box mode there is no driver. Here there always is one (#1751), so the document arrives the same way in both modes and the sampler never asksconfig.blackBox. One of the tests runs it with--blackBox=trueand another withfalse, against the same fake driver, to hold that.Not here
FitnessFunctionbinding before the injector it produces is usable, soAsyncApiModulearrives with the fitness, when it can be complete. Until thenMain'sASYNCAPIbranch keeps its message.Testing
AsyncApiSamplerTestwires the sampler through Guice and Governator — so@PostConstructruns for real — against a fakeRemoteControllerthat answers only what start-up asks. Ten tests: one action per operation of the NCS document; the same under--blackBox=true; the document fetched from a file the driver names; fifty random individuals within size bounds with every gene initialised and no setup actions; every operation tried once before combining, and again afterresetSpecialInit(); what the parser had to skip reaching theWarningsAggregatorfor the final report; and three ways start-up can fail — a document that is not there, a service that does not start, a driver declaring no AsyncAPI service — each surfacing as aSutProblemException, which is whatMainreports as a problem with the SUT rather than a crash.All AsyncAPI core suites plus the config ones: 157 tests, 0 failures.