Skip to main content

Module smoke

Module smoke 

Source
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:

  1. 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.
  2. rejects a malformed body (a route with a JSON body) — the same call with Wire("{not json") as the body, which the boundary must refuse. A service with on rejected renders that refusal itself, as a 400 the harness reads as Handled(BadRequest(_)).
  3. 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.
SmokeError
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 --smoke sets for bynk, 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. bynk computes it, since the response set is walked by bynk-ide, which the bynk binary 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 direct bynk 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. 1 when a smoke run treats an undeclared wire shape as a failure.
SYNTHETIC_SUFFIX
The tail of a synthesised suite’s file name: <stem>.smoke.bynk beside 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. report prints what was skipped and the counts; a nested run (one --against dev group) leaves that to the run that started it. On a failure the reason has been printed and the exit code is returned.