Pure: the suite x project test matrix (hc-8).
A Suite (hive-compose.schema/Suite, under :compose/suites) is a test
runner in any language. compose test suites=X,Y projects=A,B runs each
selected suite against each selected project it applies to. Each such
pair is a cell.
expand-matrix suites and the two filters to the cells
[{:suite/id :project}], unknown names as Result errors.union-needs the {consumer Needs} the cells need together, for the
capability resolver (hc-3): one stack for the matrix.runner-spec what to start for one cell in one run: a container or a
host command, with the correlation env (HIVE_RUN_ID,
HIVE_SUITE_ID, HIVE_TEST_ID_PREFIX, TRACEPARENT,
BAGGAGE), the OTLP env and the reports directory.cell-result exit code + report Result + timing to the run result
the flake history (hc-13 record-run!) takes.matrix-summary the cell results folded.Services integrate only through protocols: env vars, OTLP, JUnit XML or
TAP. No IO and no randomness here: trace ids come from an injected id
source, and the OTLP env from an injected fn (hive-compose.promote.otel/otlp-env
as data). Every entry point that can fail answers a hive-dsl Result.
Pure: the suite x project test matrix (hc-8).
A Suite (`hive-compose.schema/Suite`, under `:compose/suites`) is a test
runner in any language. `compose test suites=X,Y projects=A,B` runs each
selected suite against each selected project it applies to. Each such
pair is a cell.
- `expand-matrix` suites and the two filters to the cells
[{:suite/id :project}], unknown names as Result errors.
- `union-needs` the {consumer Needs} the cells need together, for the
capability resolver (hc-3): one stack for the matrix.
- `runner-spec` what to start for one cell in one run: a container or a
host command, with the correlation env (HIVE_RUN_ID,
HIVE_SUITE_ID, HIVE_TEST_ID_PREFIX, TRACEPARENT,
BAGGAGE), the OTLP env and the reports directory.
- `cell-result` exit code + report Result + timing to the run result
the flake history (hc-13 `record-run!`) takes.
- `matrix-summary` the cell results folded.
Services integrate only through protocols: env vars, OTLP, JUnit XML or
TAP. No IO and no randomness here: trace ids come from an injected id
source, and the OTLP env from an injected fn (`hive-compose.promote.otel/otlp-env`
as data). Every entry point that can fail answers a hive-dsl Result.(baggage cell)BAGGAGE of a cell: test.id=<test-id>, the value percent-encoded as
hive-compose.promote.otel/percent-encode does it: every byte outside the
RFC 3986 unreserved set, so / is %2F. Every baggage decoder restores
the value.
BAGGAGE of a cell: `test.id=<test-id>`, the value percent-encoded as `hive-compose.promote.otel/percent-encode` does it: every byte outside the RFC 3986 unreserved set, so `/` is `%2F`. Every baggage decoder restores the value.
(cell-key {:suite/keys [id] :keys [variant]})The suite part of a cell's identity: its suite id, or <suite>@<variant>
for a cell of a :suite/variants variant. Test ids, run dirs, container
names, the flake history and why all key on it, so two variants of one
suite never share a history or a reports dir.
The suite part of a cell's identity: its suite id, or `<suite>@<variant>` for a cell of a `:suite/variants` variant. Test ids, run dirs, container names, the flake history and `why` all key on it, so two variants of one suite never share a history or a reports dir.
(cell-result run
cell
{:keys [exit report started-at finished-at oom policy timed-out?]})One cell's outcome as the run records it (hc-13 record-run!), the shape
why and the flake history read:
{:run/id :suite/id :project :variant? :exit :status :passed|:failed|:error
:reason? :report Report? :report-error {:error :message ..}?
:started-at :finished-at :duration-ms :oom Finding?}
:suite/id is the cell's cell-key (<suite>@<variant> for a variant
cell), so the flake history and why keep variants apart; :variant
names the variant. outcome is {:exit n-or-nil :report Result<Report>
:started-at ms :finished-at ms :oom Finding? :policy VerdictPolicy?}. A
report error such as :report/none (nothing written) counts as no report;
the error is kept under :report-error, with its :skipped-files and :hint
when it carries them, so a caller of test can say WHICH report files
were left out and why, not only that there was no report. :reason is why
the cell did not pass (cell-verdict). :oom is the runner's OOM finding
(hc-16b hive-compose.promote.oom), kept as is: why prints its line and
the flake history classes the run :oom.
One cell's outcome as the run records it (hc-13 `record-run!`), the shape
`why` and the flake history read:
{:run/id :suite/id :project :variant? :exit :status :passed|:failed|:error
:reason? :report Report? :report-error {:error :message ..}?
:started-at :finished-at :duration-ms :oom Finding?}
`:suite/id` is the cell's `cell-key` (`<suite>@<variant>` for a variant
cell), so the flake history and `why` keep variants apart; `:variant`
names the variant. `outcome` is {:exit n-or-nil :report Result<Report>
:started-at ms :finished-at ms :oom Finding? :policy VerdictPolicy?}. A
report error such as :report/none (nothing written) counts as no report;
the error is kept under :report-error, with its :skipped-files and :hint
when it carries them, so a caller of `test` can say WHICH report files
were left out and why, not only that there was no report. `:reason` is why
the cell did not pass (`cell-verdict`). `:oom` is the runner's OOM finding
(hc-16b `hive-compose.promote.oom`), kept as is: `why` prints its line and
the flake history classes the run :oom.(cell-status exit report)(cell-status exit report policy)How a cell ended: the :status of cell-verdict.
How a cell ended: the :status of `cell-verdict`.
(cell-verdict exit report)(cell-verdict exit
report
{:keys [report-required? skip-fails? timed-out? oom?]}){:status :passed|:failed|:error :reason kw?} of a cell that ended with
exit (nil: killed or timed out) and report (a Result<Report> as the
reader answers it, a bare Report, or nil for none), under policy
({:report-required? :skip-fails? :timed-out? :oom?}, all default false).
The law: :passed ONLY when the runner ran to a clean exit 0, was neither killed nor timed out, its report (when one is required) parsed completely and holds at least one case, and no case failed. A test saying no is :failed; anything that could not run, or whose report cannot be trusted, is :error (exit 2).
{:status :passed|:failed|:error :reason kw?} of a cell that ended with
`exit` (nil: killed or timed out) and `report` (a Result<Report> as the
reader answers it, a bare Report, or nil for none), under `policy`
({:report-required? :skip-fails? :timed-out? :oom?}, all default false).
The law: :passed ONLY when the runner ran to a clean exit 0, was neither
killed nor timed out, its report (when one is required) parsed completely
and holds at least one case, and no case failed. A test saying no is
:failed; anything that could not run, or whose report cannot be trusted,
is :error (exit 2).
- A report error other than :report/none (malformed, truncated,
unreadable, uncollectable): :error with the report category as reason,
whatever the exit code and whatever :report-required? says.
- No report: :error (reason :report/none) when one is required, :error
(reason :runner/oom or :runner/timeout) when it was killed, else the
exit code is the verdict (0 :passed, else :error: it died before it
reported).
- A required report with no case: :error (reason :report/empty).
- Failed or errored cases: :failed (reason :cases/failed).
- Killed (OOM, timeout) with no failed case: :error (reason as above).
- A bail-out, or a non-zero or missing exit: :failed.
- A skipped case under :skip-fails?: :failed :skipped-as-failure (the
case itself stays :skipped in the report).
- Anything else: :passed.(container-name run sid project)hive-<run>-<slug suite>-<slug project>-<8 hex>: the slugs keep it
readable, the hash of the exact ids keeps two cells whose ids slug alike
("a.b" and "a-b") from sharing a container name.
`hive-<run>-<slug suite>-<slug project>-<8 hex>`: the slugs keep it
readable, the hash of the exact ids keeps two cells whose ids slug alike
("a.b" and "a-b") from sharing a container name.Where a container runner writes reports, unless its suite names another directory.
Where a container runner writes reports, unless its suite names another directory.
The env vars hive-compose owns in a runner's env. Nothing a suite or a wiring sets overrides them, so every run stays correlated.
The env vars hive-compose owns in a runner's env. Nothing a suite or a wiring sets overrides them, so every run stays correlated.
The exit code of a matrix, by its status: 0 every cell passed, 1 a test failed (and nothing could not run), 2 something could not run (infra, the runner, a missing or empty report, a data phase). 2 wins over 1.
The exit code of a matrix, by its status: 0 every cell passed, 1 a test failed (and nothing could not run), 2 something could not run (infra, the runner, a missing or empty report, a data phase). 2 wins over 1.
(expand-matrix suites projects filters)Result<[{:suite/id :project :variant?}]>: the cells of suites ({id Suite})
over projects ({id Project}), sorted by suite, then variant, then project.
filters is {:suites :projects :variants}, each in a form parse-names
takes, nil for all. A suite that lists :suite/projects runs against
those, any other suite against every project. The projects filter narrows
that further. A suite that declares :suite/variants gives one cell per
variant (:variant its name), each a cell of its own; the variants filter
narrows those, and leaves a suite without variants alone (it runs once).
No selected suite ever vanishes: with a variants filter, every selected suite that declares variants must declare EVERY requested one, else the call is refused naming the missing ones per suite.
Errors: :compose/unknown-names when a filter or a selected suite's
:suite/projects names a suite or project that does not exist, or a
requested variant is missing from a selected suite that declares variants
(:variants {suite [missing]}), or no selected suite declares variants at
all (:variants {"*" [requested]}). Every such name is listed under
:suites, :projects, :suite-projects or :variants. The error is
:compose/empty-matrix when the filters leave no cell.
Result<[{:suite/id :project :variant?}]>: the cells of `suites` ({id Suite})
over `projects` ({id Project}), sorted by suite, then variant, then project.
`filters` is {:suites :projects :variants}, each in a form `parse-names`
takes, nil for all. A suite that lists `:suite/projects` runs against
those, any other suite against every project. The projects filter narrows
that further. A suite that declares `:suite/variants` gives one cell per
variant (`:variant` its name), each a cell of its own; the variants filter
narrows those, and leaves a suite without variants alone (it runs once).
No selected suite ever vanishes: with a variants filter, every selected
suite that declares variants must declare EVERY requested one, else the
call is refused naming the missing ones per suite.
Errors: :compose/unknown-names when a filter or a selected suite's
`:suite/projects` names a suite or project that does not exist, or a
requested variant is missing from a selected suite that declares variants
(:variants {suite [missing]}), or no selected suite declares variants at
all (:variants {"*" [requested]}). Every such name is listed under
:suites, :projects, :suite-projects or :variants. The error is
:compose/empty-matrix when the filters leave no cell.(layer-env {:keys [wiring otlp suite-env correlation merge-ra run test-id]})The runner env, built in layers: wiring (the suite consumer's endpoints),
then otlp, then suite-env, then correlation, forced on top. At each
layer otel/otlp-pair-merge keeps OTEL_EXPORTER_OTLP_ENDPOINT and
OTEL_EXPORTER_OTLP_PROTOCOL one unit. OTEL_RESOURCE_ATTRIBUTES is merged
per key through merge-ra (fn [base over], default
otel/merge-resource-attributes) in the same order, wiring < otlp <
suite. Then the hive.* correlation keys are forced: those of the otlp
attributes, plus hive.run.id=<run> and hive.test.id=<test-id> always.
The suite still sets service.name and its own attributes.
The runner env, built in layers: `wiring` (the suite consumer's endpoints), then `otlp`, then `suite-env`, then `correlation`, forced on top. At each layer `otel/otlp-pair-merge` keeps OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL one unit. OTEL_RESOURCE_ATTRIBUTES is merged per key through `merge-ra` (fn [base over], default `otel/merge-resource-attributes`) in the same order, wiring < otlp < suite. Then the `hive.*` correlation keys are forced: those of the otlp attributes, plus `hive.run.id=<run>` and `hive.test.id=<test-id>` always. The suite still sets service.name and its own attributes.
(matrix-exit status)The exit code of matrix status status (exit-codes).
The exit code of matrix status `status` (`exit-codes`).
(matrix-stack run cells)The Stack value of the matrix of cells in run: id test-<run>, with
the projects under test as its consumers. The suites' own needs are not
part of it; they reach the resolver as extra needs (see union-needs).
The Stack value of the matrix of `cells` in `run`: id `test-<run>`, with the projects under test as its consumers. The suites' own needs are not part of it; they reach the resolver as extra needs (see `union-needs`).
(matrix-summary results)The cell results folded. The order of results does not change it:
{:status the worst cell (:error > :failed > :passed; :passed for none)
:exit matrix-exit of :status: 0 passed, 1 failed, 2 could not run
:cells n :passed n :failed n :error n
:cases the report totals summed {:passed :failed :error :skipped}
:by-suite {suite {status n}} :by-project {project {status n}}
:failures [{:suite/id :project :status :exit :reason? :cases [case ids]}], sorted
:duration-ms the sum over the cells that report one}
The cell results folded. The order of `results` does not change it:
{:status the worst cell (:error > :failed > :passed; :passed for none)
:exit `matrix-exit` of :status: 0 passed, 1 failed, 2 could not run
:cells n :passed n :failed n :error n
:cases the report totals summed {:passed :failed :error :skipped}
:by-suite {suite {status n}} :by-project {project {status n}}
:failures [{:suite/id :project :status :exit :reason? :cases [case ids]}], sorted
:duration-ms the sum over the cells that report one}(parse-names v)A filter as a sorted vector of distinct names, or nil for no filter. Takes
"X,Y" (blank parts dropped), a collection of strings, keywords or
symbols, or nil. A filter that names nothing ("" or " , ") is no filter.
A filter as a sorted vector of distinct names, or nil for no filter. Takes
`"X,Y"` (blank parts dropped), a collection of strings, keywords or
symbols, or nil. A filter that names nothing ("" or " , ") is no filter.(path-part? s)True when s is one safe path segment: hive-compose.boundary.runs/PathPart
(letters, digits, _ . -, starting with a letter or digit, never only
dots). Suite and project ids name directories under the run dir and the
container name, so anything else (.., a/../b, /abs, a:b, a@b) is
refused. A variant cell's <suite>@<variant> key is built from two such
parts, never parsed from one.
True when `s` is one safe path segment: `hive-compose.boundary.runs/PathPart` (letters, digits, `_` `.` `-`, starting with a letter or digit, never only dots). Suite and project ids name directories under the run dir and the container name, so anything else (`..`, `a/../b`, `/abs`, `a:b`, `a@b`) is refused. A variant cell's `<suite>@<variant>` key is built from two such parts, never parsed from one.
(report-required? suite)Whether a cell of suite must leave a report to pass: when it says so with
:suite/report-required?, else when it is a container suite
(:suite/image: it always has its reports mount) or declares where or how
it reports (:suite/reports-dir or :suite/report-format). Only an
explicit :suite/report-required? false opts out (its exit code is then
the verdict when no report is found).
Whether a cell of `suite` must leave a report to pass: when it says so with `:suite/report-required?`, else when it is a container suite (`:suite/image`: it always has its reports mount) or declares where or how it reports (`:suite/reports-dir` or `:suite/report-format`). Only an explicit `:suite/report-required? false` opts out (its exit code is then the verdict when no report is found).
(reports-dir state-dir run cell)The host directory a cell's reports land in: <run-dir>/reports.
The host directory a cell's reports land in: `<run-dir>/reports`.
(run-dir state-dir run {:keys [project] :as cell})<state-dir>/runs/<run>/<cell-key>/<project>: everything one cell leaves
behind (<suite>@<variant> for a variant cell).
`<state-dir>/runs/<run>/<cell-key>/<project>`: everything one cell leaves behind (`<suite>@<variant>` for a variant cell).
(runner-outcome answer report)The cell-result outcome of an ISuiteRunner answer answer (hc-16b
hive-compose.port/-run!: {:exit :started-at :finished-at :oom ..}) and
the cell's report (Result<Report>). A timed-out runner has exit nil.
The `cell-result` outcome of an ISuiteRunner answer `answer` (hc-16b
`hive-compose.port/-run!`: {:exit :started-at :finished-at :oom ..}) and
the cell's `report` (Result<Report>). A timed-out runner has exit nil.(runner-spec {:keys [suites run state-dir id-source wiring-env] :as ctx} cell)Result<RunnerSpec> of cell in run run.
ctx:
:suites {id Suite}
:run RunId
:state-dir hive-compose's state directory
:id-source (fn [n-bytes]) returning 2n lowercase hex chars, for the
trace and span ids
:otlp-env optional (fn [{:run-id :service :test-id :side}]) -> Env,
i.e. hive-compose.promote.otel/otlp-env; nil injects no OTLP
:merge-resource-attributes optional, see layer-env
:wiring-env optional Env of the suite consumer's wiring (hc-5)
:default-resources optional, :compose/default-resources
A suite with :suite/image gives a container:
{:runner :container :image :command? :env :mounts [{:host :container}]
:network (the view network of the project under test) :labels :name}
Any other suite gives a host command {:runner :command :command :dir? :env}.
A container of a suite with :suite/needs also joins the view network of
suite:<id> (:extra-networks), where the suite's own instances answer.
Both carry :cell :run :test-id :trace-id :reports-dir and :report-format,
:resources (:suite/resources, else :default-resources; :unbounded
passes through) and :timeout-ms when set. :reports-dir is always the
cell's own <state-dir>/runs/<run>/<suite>/<project>/reports, so no two
cells share one. A command that names :suite/reports-dir (relative to
:suite/dir, never leaving it) also carries it as :collect-from: the
pipeline empties it before the cell and moves what the runner leaves there
into :reports-dir after.
Refused: an unknown suite, a bad run id, a suite or project id that is not
path-part?, a command's reports dir that is absolute, climbs out with
.. or has no :suite/dir to be relative to (:compose/invalid-param), and
an env holding half the OTLP pair (:compose/otlp-pair-broken).
Result<RunnerSpec> of `cell` in run `run`.
`ctx`:
:suites {id Suite}
:run RunId
:state-dir hive-compose's state directory
:id-source (fn [n-bytes]) returning 2n lowercase hex chars, for the
trace and span ids
:otlp-env optional (fn [{:run-id :service :test-id :side}]) -> Env,
i.e. `hive-compose.promote.otel/otlp-env`; nil injects no OTLP
:merge-resource-attributes optional, see `layer-env`
:wiring-env optional Env of the suite consumer's wiring (hc-5)
:default-resources optional, `:compose/default-resources`
A suite with `:suite/image` gives a container:
{:runner :container :image :command? :env :mounts [{:host :container}]
:network (the view network of the project under test) :labels :name}
Any other suite gives a host command {:runner :command :command :dir? :env}.
A container of a suite with `:suite/needs` also joins the view network of
`suite:<id>` (:extra-networks), where the suite's own instances answer.
Both carry :cell :run :test-id :trace-id :reports-dir and :report-format,
:resources (`:suite/resources`, else `:default-resources`; `:unbounded`
passes through) and :timeout-ms when set. :reports-dir is always the
cell's own `<state-dir>/runs/<run>/<suite>/<project>/reports`, so no two
cells share one. A command that names `:suite/reports-dir` (relative to
`:suite/dir`, never leaving it) also carries it as :collect-from: the
pipeline empties it before the cell and moves what the runner leaves there
into :reports-dir after.
Refused: an unknown suite, a bad run id, a suite or project id that is not
`path-part?`, a command's reports dir that is absolute, climbs out with
`..` or has no `:suite/dir` to be relative to (:compose/invalid-param), and
an env holding half the OTLP pair (:compose/otlp-pair-broken).What runner-spec answers. Kept here because the stack schema belongs to
core.
What `runner-spec` answers. Kept here because the stack schema belongs to core.
(suite-consumer suite-id)The consumer id a suite's own :suite/needs are bound to: suite:<id>
(see hive-compose.schema/ConsumerId).
The consumer id a suite's own `:suite/needs` are bound to: `suite:<id>` (see `hive-compose.schema/ConsumerId`).
(test-id {:keys [project] :as cell})The test id of a cell, <suite>/<project> (<suite>@<variant>/<project>
for a variant cell). Baggage test.id and the OTLP resource attribute
hive.test.id carry it.
The test id of a cell, `<suite>/<project>` (`<suite>@<variant>/<project>` for a variant cell). Baggage `test.id` and the OTLP resource attribute `hive.test.id` carry it.
(test-id-prefix cell)HIVE_TEST_ID_PREFIX of a cell, <suite>/<project>/: a runner names the
spans of its test t <prefix><t>.
HIVE_TEST_ID_PREFIX of a cell, `<suite>/<project>/`: a runner names the spans of its test `t` `<prefix><t>`.
(traceparent id-source)Result<{:trace-id :span-id :traceparent}>: a fresh sampled W3C
traceparent, 00-<trace-id>-<span-id>-01. id-source is (fn [n-bytes])
returning 2n lowercase hex chars. This fn calls it and never calls rand.
Result<{:trace-id :span-id :traceparent}>: a fresh sampled W3C
traceparent, `00-<trace-id>-<span-id>-01`. `id-source` is (fn [n-bytes])
returning 2n lowercase hex chars. This fn calls it and never calls `rand`.(union-needs suites projects cells)The {consumer Needs} that cells need together, in the shape the
capability resolver (hc-3 resolve-needs) takes. It holds every project
under test with its :project/needs (an empty map when it has none; the
project still comes up) and every suite with :suite/needs, under
suite-consumer. Nothing else goes in, and the order of cells does not
change the result. The maps are sorted.
The {consumer Needs} that `cells` need together, in the shape the
capability resolver (hc-3 `resolve-needs`) takes. It holds every project
under test with its `:project/needs` (an empty map when it has none; the
project still comes up) and every suite with `:suite/needs`, under
`suite-consumer`. Nothing else goes in, and the order of `cells` does not
change the result. The maps are sorted.(verdict-policy suite skip-fails?)The cell-verdict policy of suite for a call whose skip-fails? is given
(nil: the suite's own :suite/skip-fails?, default false):
{:report-required? bool :skip-fails? bool}.
The cell-verdict policy of `suite` for a call whose `skip-fails?` is given
(nil: the suite's own `:suite/skip-fails?`, default false):
{:report-required? bool :skip-fails? bool}.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |