demo-test

End-to-end demo-test runner: provisions a demo dataset via the control plane, runs setup/queries/cleanup SQL, emits a JSON report.

Category: commands

Syntax

delta-forge-cli demo-test <NODE> <ZONE> <DEMO_PATH> [TARGET_DIR] [--local <DIR>] [--phase setup|queries|cleanup|all] [--drop-schema] [--drop-zone]

Description

## Overview `demo-test` is the end-to-end harness used by CI and by the `demo-run` skill. It provisions a demo dataset via the control plane's provision API, executes the demo's setup/queries/cleanup SQL in order against the specified compute node and zone, and emits a structured JSON report suitable for regression comparison. Before executing any SQL, three variables are injected into each script: `{{zone_name}}` (the `ZONE` argument), `{{data_path}}` (the zone-relative path to provisioned data, returned by the provision API), and `{{current_user}}` (the authenticated username). ## Behavior - `NODE`, `ZONE`, and `DEMO_PATH` are positional and required. `TARGET_DIR` is positional and optional. - `--phase` selects a subset of lifecycle steps. The harness discovers `setup.sql`, `queries.sql`, and `cleanup.sql` in the demo directory (or in `--local` when passed) and runs the ones that match the phase. - `--local` overrides only the SQL file location. Data paths continue to come from the provisioned environment. This supports rapid iteration: provision once, then rerun `--phase queries --local <dir>` after each edit. - Cleanup is deliberately conservative. The demo's own teardown SQL runs unconditionally when `--phase cleanup` or `all` is selected, but `DROP SCHEMA` and `DROP ZONE` require the explicit `--drop-schema` and `--drop-zone` flags. This protects shared zones that host multiple demos. - Output is a JSON report on stdout with per-phase statement counts, execution times, and error details. Progress and diagnostic messages go to stderr. - Exit code is 0 when every statement in every selected phase succeeds, 1 when any statement fails, 2 on client-initialisation errors. - Path separators inside `data_path` (returned from the provision API) are normalised by this command before substitution, so demos authored on either Windows or Unix paths behave consistently at the SQL layer. ## Compatibility - The report schema is stable and is what regression tooling (for example, the `demo-validate` skill) consumes. - `demo-test` is distinct from `run` because it owns the provision-and-teardown lifecycle, injects the three demo variables, and understands the phase layout. For plain SQL files without a demo manifest, use `run` instead.

Parameters

NameTypeDescription
NODECompute node display name or `entity_ref`. Resolved against the control plane and used for every SQL statement in the run.
ZONETarget zone where demo data lands. Injected into SQL scripts as `{{zone_name}}`.
DEMO_PATHRepo-relative demo path (for example, `demos/csv/sales-quickstart`). Used by the control plane's provision API to locate the demo manifest and source data.
TARGET_DIRFilesystem directory that receives provisioned demo data. The built-in default is a Windows-specific user path; pass an explicit value on other platforms.
--localOverride SQL file location with a local directory. The provisioned `data_path` still comes from the control plane, so setup/queries/cleanup scripts can be iterated on locally without reprovisioning.
--phaseWhich phase to run. Valid values: `setup`, `queries`, `cleanup`, `all`. Default `all` runs every phase in order.
--drop-schemaWhen running the cleanup phase, also emit `DROP SCHEMA` for schemas the demo created. Opt-in because demos are often re-run against the same zone.
--drop-zoneWhen running the cleanup phase, also emit `DROP ZONE`. Opt-in, and typically combined with `--drop-schema`.

Examples

# Full run: setup, queries, cleanup
delta-forge-cli demo-test prod-node-01 landing demos/csv/sales-quickstart
# Iterate on queries only, against pre-provisioned data and a local SQL directory
delta-forge-cli demo-test prod-node-01 landing demos/csv/sales-quickstart --phase queries --local ./demos/csv/sales-quickstart
# Teardown including schema and zone
delta-forge-cli demo-test prod-node-01 landing demos/csv/sales-quickstart --phase cleanup --drop-schema --drop-zone
# Capture the JSON report for regression comparison
delta-forge-cli demo-test prod-node-01 landing demos/csv/sales-quickstart >report.json
jq '.queries.failures' report.json
# Override target directory on non-Windows hosts
delta-forge-cli demo-test prod-node-01 landing demos/csv/sales-quickstart /var/lib/deltaforge/demos

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →