Skip to main content

Module script

Module script 

Source
Expand description

Executes a text command script against clusterd.

Instead of recompiling a Rust scenario, a test (or an agent) writes a crate::text script: a sequence of commands, each with an expected output block (----) that is the assertion. The coarse orchestration verbs map almost directly to Driver calls; define carries arbitrary MIR (as pretty-form specs parsed by mz-expr-parser, the .spec test syntax) over the full DataflowBuilder surface, including index imports, while define_index stays as sugar for the common single-index shape. Explicit write_rows payloads are typed against the schema token-by-token via cell_from_token (reusing mz_repr::strconv) rather than Row’s opaque serde.

§Execution

run parses the script, executes each command, and compares its golden output to the expected block — failing the run on a mismatch, or rewriting the file when REWRITE is set. A command that fails renders as error: <message>, so an expected failure is asserted by its golden block. Assertions are level-triggered waits on monotonic frontiers, so a single sequential script is deterministic regardless of how the dataflows interleave.

Shards are referenced by a string alias; the first command naming an alias allocates a fresh ShardId for it. Object ids are raw u64s mapped to GlobalId::User.

Structs§

BuildSpec
A MIR object to build in a define command.
ColumnSpec
A column declaration in a define_schema command.
ConfigSetting
A single dyncfg update in an update-configuration command: a config name, a type tag selecting how value is parsed (bool/u32/usize/f64/string/ duration), and the value. Typed against mz_dyncfg at execution.
ScriptState
Mutable state threaded through a script run.

Enums§

Command
A command read from the script stream.
ExportSpec
An export in a create-dataflow command, mirroring the export kinds a real dataflow produces (see mz_compute_types::sinks::ComputeSinkConnection). copy-to is intentionally absent: the parser rejects it as unimplemented.
ImportSpec
A collection to import in a define command: a persist source or an existing index. Externally tagged: {"source": {…}} or {"index": {…}}.

Functions§

run
Run a script: parse content into stanzas, execute each command, and either compare its output to the stanza’s expected block or — when REWRITE is set and path is given — rewrite the file in place with the actual outputs.