Skip to content

Test Dialect fixtures.

Usage

rootform test [directory] [options]
SHELL

Options

FlagTypeDefaultDescription
--dialectstringArray[]use Dialect source dir for this command only; repeatable
--formatstring""output format: text|json; default: text
--runstring""run only the cases whose name contains this text
--updateboolfalsewrite the golden of every differing or new case

Global options

FlagTypeDefaultDescription
-h, --helpboolfalseshow how to use rootform test
--colormodeautocolor human output: auto|always|never; default: auto
--no-pagerboolfalseprint a long report in full instead of opening it in less

Behavior

Analyze Dialect fixtures and compare the Forms they produce with the recorded ones. A fixture is a directory holding one plan.json or state.json export and an analysis.golden Form; the project at the test directory selects the Dialects. A plan.tfplan saved plan beside plan.json must pair with it, and its configuration snapshot then contributes the facts that follow references.

A golden records the Form with only the Dialect definitions it reaches. The comparison ignores which Rootform version and which Dialect versions recorded it. With --update, test writes the produced golden for every case that differs, and for a directory holding an export but no golden yet.

Without a directory, test reads the current directory. Text or JSON results go to standard output. Diagnostics go to standard error.

Exit status

StatusDescription
0every selected fixture passed or, with --update, was recorded
1at least one fixture differed or could not be analyzed
2the command was used incorrectly
3rootform.lock is invalid or no fixtures matched
4fixture files, rootform.lock, Dialects, or the report could not be read or written

Examples

rootform test
rootform test ./fixtures
rootform test ./fixtures --run cloud-sql
rootform test ./fixtures --format json
rootform test ./fixtures --update
Shell

Follow Test and validate for the fixture workflow and Policy evaluation examples.