Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mz-test

БесплатноБез исполняемых скриптовНе проверен

Run tests + pick test framework in Materialize. Trigger: "run tests", "run testdrive", "run sqllogictest", "run mzcompose", "run cargo test", "run pgtest"…

MaterializeIncот MaterializeInc★ 6 417 звёзд на GitHub

Об этом скилле

Testing Materialize

Cluster sizes

mzcompose-based tests and bin/environmentd take their cluster replica sizes from cluster_replica_size_map() in misc/python/materialize/mzcompose/__init__.py, named scale=<n>,workers=<w>[,mem=<n>GiB], e.g. CREATE CLUSTER c SIZE 'scale=1,workers=1'. Plain sizes like '1' fail there with "unknown cluster replica size". The emulator image run directly knows only cloud-style sizes (25cc, 50cc, ...).

Unit tests

Run unit tests with cargo test. If available, use cargo nextest instead. If these complain about METADATA_BACKEND_URL, then use bin/cargo-test instead. bin/cargo-test sets METADATA_BACKEND_URL from its --postgres argument, which defaults to MZDEV_POSTGRES or else the local CockroachDB, and overwrites any value already in the environment. To run against another metadata store, pass --postgres or set MZDEV_POSTGRES. It also sets RUST_MIN_STACK=8388608, which some tests need to avoid stack overflows. CI's cargo-test step sets 4194304. A bare cargo test or cargo nextest run sets neither, so export it yourself. When using -p, our packages typically have an mz- suffix, e.g., mz-adapter. Rewrite datadriven test expectations with REWRITE=1 cargo test .... Do not manually update *.snap files. Use cargo test followed by cargo insta accept to update snapshot files.

Scalar function registry

cargo test -p mz-compute-types --test func_registry snapshots every UnaryFunc, BinaryFunc, and VariadicFunc variant's properties and #[sqlfunc] body fingerprint into src/compute-types/tests/snapshots/. It fails when a variant is added or removed, when a recorded property changes, and when a #[sqlfunc] declaration or body changes. It records nothing for the bodies of hand-written variants, so a change to one of those passes. Removals and property changes to a shipped LIR_VERSION require a bump before regenerating, because a rewrite at the old version silently overwrites that version's digest. See the mz-commit skill for the decision procedure. Then regenerate with REWRITE=1 cargo test -p mz-compute-types --test func_registry and review the JSON diff. Never edit those files by hand. A new variant whose payload carries data needs a Sample in src/expr/src/scalar/func/registry.rs, and the panic names the function to add it to.

The sibling --test lir_schema snapshots the serde schema of the whole LIR plan into lir_v{LIR_VERSION}.json and fails on shape changes anywhere under src/compute-types/src/plan, including *Func payloads. Regenerate with REWRITE=1 cargo test -p mz-compute-types --test lir_schema.

Some tests require access to a metadata store. Set environment variables to COCKROACH_URL=postgres://root@localhost:26257 METADATA_BACKEND_URL=postgres://root@localhost:26257.

Control log output during tests with MZ_TEST_LOG_FILTER=<level>, e.g. MZ_TEST_LOG_FILTER=debug cargo test ....

The first run includes a cargo build step that can take several minutes. Use a bash timeout of at least 600000ms (10 min) for test commands.

sqllogictest

Run sqllogictest files with:

bin/sqllogictest -- PATH [PATH ...]

PATH is relative to the repo root, usually a file in test/sqllogictest/. sqllogictest accepts a list of files, not just one, and runs them in order. Prefer batching files into one invocation: each invocation bootstraps a fresh catalog and cluster, which is slow, so batching amortizes that startup cost across files instead of paying it per file. It also matches how CI drives the suite, so goldens generated one-file-per-process can diverge from CI's batched context. Rewrite expected results with bin/sqllogictest -- --rewrite-results PATH. Override one system parameter with bin/sqllogictest -- --system-parameter-default=NAME=VALUE PATH. The wrapper passes its own defaults first and the last value per name wins. After timeout N bin/sqllogictest ... expires, sqllogictest and its clusterd processes keep running. The mz-run skill explains why and how to stop them.

Before blaming a change for a golden failure, run the same file on upstream/main in a detached worktree. Not every file runs on PRs: compileFastSltConfig in test/sqllogictest/mzcompose.py excludes some (e.g. distinct_arrangements.slt), which then only run in Nightly, so their goldens can be stale on main. test/sqllogictest/introspection/relations.slt pins dataflow channel container type names, so changing an operator's output container needs --rewrite-results on it.

When a plan changes only because of nondeterministic IDs in the output, normalize it with sqllogictest's replace directive rather than running files isolated to dodge the ID noise. Treat catalog-bloat plan drift as a real signal to investigate, not ID text noise.

Add --optimized when running many or large files: it significantly improves execution speed at the cost of a longer one-time compile. For a single small file, skip --optimized

Полный SKILL.md на GitHub

Установить mz-test в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл mz-test?

Run tests + pick test framework in Materialize. Trigger: "run tests", "run testdrive", "run sqllogictest", "run mzcompose", "run cargo test", "run pgtest", "rewrite test results", "add a test", "reproduce a bug", "write a regression test", or mentions testing, testdrive, sqllogictest, mzcompose, pgtest, cargo test, nextest, flaky tests, test failures. Also "test this" or "how do I verify this works". Specifics: mz-platform-checks (upgrade/restart survival), mz-parallel-workload (concurrent stress), mz-limits-test (many objects).

Как установить скилл mz-test?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mz-test запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mz-test с