Expand description
bynk test --smoke (#2658): a system suite per context, derived from its
from http services, so every declared route is exercised on a real
runtime without a test written for it.
Each route gets up to three cases, all in existing test surface:
- answers — a typed call with every argument fabricated by
Val, under a fabricated principal; it passes unless the answer is a 5xx. A smoke input is valid by construction, so a server error is the defect a smoke exists to find, even one the handler constructs itself. - rejects a malformed body (a route with a JSON
body) — the same call withWire("{not json")as the body, which the boundary must refuse. A service withon rejectedrenders that refusal itself, as a400the harness reads asHandled(BadRequest(_)). - refuses no credential (a route whose principal is not public) — the
same call
by Nobody, which the auth seam must refuse.
The synthesised suites are added to the build’s source overlay, beside the
context file they test, as the doc-example suites are (#2461), and the
project’s own suites are left out: a smoke run runs only the smoke. Whether a
case can be built is decided by checking it: a case whose check reports one
of the codes in SKIPPABLE (a Matches type Val cannot fabricate, a
principal it cannot construct) is dropped and reported as skipped, with the
checker’s reason. Any other diagnostic in a synthesised suite is a bug in
this module, never a skip, so a run cannot pass green by skipping everything.
Structs§
- Prepared
- A smoke run ready to build: the options with the synthesised suites in place of the project’s own, and the skips to report.
- Skip
- A route the smoke run does not call, and why.
- Smoke
- The smoke suites for a project, and what they leave out.
Enums§
- Methods
- Which routes a smoke run may call.
- Smoke
Error - Why a smoke run cannot go ahead.
Constants§
- CASE_
PREFIX - Every case a smoke suite holds is named with this prefix, so it cannot collide with a case the author wrote.
- DECLARED_
ENV - #2685: the environment variable
bynk test --smokesets forbynk, the path of a file holding a JSON object from each route’s key (<context> <service> <METHOD> <path>) to the statuses its handler can answer.bynkcomputes it, since the response set is walked bybynk-ide, which thebynkbinary does not carry; the test runtime warns (bynk.test.smoke_undeclared_status) when a smoke case gets a non-5xx answer outside its route’s set. Without it, as in a directbynk test --smoke, a smoke run compares nothing. The file a smoke run writes the declared statuses it saw to. - STRICT_
WIRE_ ENV - The environment variable that turns on the test runtime’s strict decoding
of an answer (
responseToHttpResult): a smoke case fails on a status the runtime does not know, or a JSON body that does not decode as the route’s declared type, where an author’s own case gets the raw value to judge.1when a smoke run treats an undeclared wire shape as a failure. - SYNTHETIC_
SUFFIX - The tail of a synthesised suite’s file name:
<stem>.smoke.bynkbeside the context’s<stem>.bynk. - UNDECLARED_
STATUS_ CODE - #2685: the code of the warning a smoke case carries for an answer its route does not declare.
Functions§
- prepare
- Synthesise and settle the smoke suites over
options’ sources.reportprints what was skipped and the counts; a nested run (one--against devgroup) leaves that to the run that started it. On a failure the reason has been printed and the exit code is returned.