Testing
Tests are organized by cost: run just check on every change, then run the heavier lane that
matches the subsystem you touched before pushing.
| Lane | Command | Prerequisites |
|---|---|---|
| Rust unit & DB tests | just test |
Dev shell |
| Linux-only Rust tests | just linux-test |
Docker (Colima on macOS) |
| Web UI & agents sidecar | pnpm test in web/ and agents/ |
Dev shell |
| UI end-to-end | just web-e2e |
Chrome |
| Real S3 store | just s3-test |
Docker |
| Guest image microVM smoke | just kvm-test |
Docker with /dev/kvm |
| Machines end-to-end | just kvm-e2e |
Docker with /dev/kvm |
| NixOS cluster VM tests | just vm-test single|ha|iso |
aarch64-linux builder on macOS, or KVM on Linux |
| Pre-release gate | just preflight + just kvm-e2e --dev --smoke --garage-store |
Linux builder, Xcode, Docker with /dev/kvm |
Rust unit and database tests
Section titled “Rust unit and database tests”just test # full workspace against local Postgresjust test -p anastro-api --test threads # single integration test fileDatabase tests use #[sqlx::test], giving each test an isolated scratch database inside .data/pg
(started automatically by just test). Most API behavior lives in crates/api/tests/ using
crates/fakehost in place of real microVMs.
For Linux-only crates (host networking, microVM launcher, guest agent), run inside a privileged Linux container from macOS:
just linux-test # defaults to -p anastro-hostagent -p anastro-guestjust linux-test -p anastro-hostagent # or any cargo test argsWeb UI and agents sidecar
Section titled “Web UI and agents sidecar”cd web && pnpm typecheck && pnpm test # Vitest + Testing Librarycd agents && pnpm typecheck && pnpm testjust web-e2e runs Playwright (web/e2e/) against real machined, apid, the built UI, the
agents sidecar, and a scratch Postgres (web/e2e/stack.ts), signing each browser in through
anastroctl ui. Uses installed Chrome by default (override via E2E_CHANNEL).
Real S3 store
Section titled “Real S3 store”just s3-testSpins up RustFS in Docker, creates a bucket, and exercises object store probes, STS scoped
credentials, and workspace uploads. Set ANASTRO_TEST_S3="<endpoint> <bucket> <key> <secret>" to
target another S3-compatible endpoint.
Machines on KVM
Section titled “Machines on KVM”Requires Docker with /dev/kvm (Colima with vmType: vz and nestedVirtualization: true on
macOS) and an aarch64-linux Nix builder.
just kvm-test # boot guest image under Cloud Hypervisor and check anastro-guestjust kvm-run <dir> <cmd>... # run a static Linux binary from <dir> inside the KVM containerjust kvm-e2e (nix/kvm-e2e/) boots a converged node and a worker-only node in containers and
exercises real machines end to end: scheduling, bash, terminals, network isolation, spin-down and
resume, live migration between hosts, S3 workspaces with checkpoints/history/restores/forks, and
threads against a fake model. A full run takes up to two hours.
| Flag / subcommand | Effect |
|---|---|
just kvm-e2e |
Boot, run full suite, tear down |
--dev |
Use cargo zigbuild’s anastrod instead of rebuilding the Nix package |
--local-store |
Use a shared host directory instead of RustFS S3 |
--garage-store |
Run in-cluster Garage on node1, reached by node2 via forwarder |
--smoke |
Boot, checkpoint to store, and restore only (minutes instead of ~90 min) |
--keep |
Leave containers running afterward |
up / test / shell [-n <node>] / down / clean |
Drive lifecycle steps manually |
NixOS cluster VM tests
Section titled “NixOS cluster VM tests”Boots the real NixOS node image as QEMU VMs (nix/clusters/), using a fresh temp directory per run
so suites can run in parallel:
just vm-test singlejust vm-test hajust vm-test isojust vm-repl ha # interactive NixOS test driver Python REPL| Suite | Exercises |
|---|---|
single |
Empty-disk install, migrations, config apply/reject, backups, PITR restore, backup verification, alerts, OTLP export, secret store, TPM /var sealing, full reset |
ha |
3-node bootstrap, device enrollment, relay-only paths, revocation, node API, switchover, rolling apply, S3 backups, failover, rejoin, disk replacement + peer unseal, node reset, etcd quorum alert, A/B upgrades, total-loss rebuild via bootstrap --restore-from |
iso |
Installing from virtual CD-ROM ISO, then booting installed disk with and without ISO still attached |
In vm-repl, drive VMs with start_all(), cp1.shell_interact(), cp1.crash(), and
test_script(). On Linux these are also flake checks (vm-single, vm-ha, vm-iso). On macOS,
just vm-test keeps the machine awake so VM clocks don’t drift during sleep.
What CI runs
Section titled “What CI runs”.github/workflows/ci.yml runs on every push to main and every pull request:
| Job | Checks |
|---|---|
workflow-security |
scripts/check-github-actions.sh and its tests |
rust |
cargo fmt --check, clippy -D warnings, cargo xtask codegen --check, cargo test --workspace |
rust-security |
RustSec checks, cargo deny advisories for both workspaces, cargo check of the desktop app |
web |
pnpm codegen clean, pnpm typecheck, pnpm test, pnpm build |
agents |
pnpm codegen clean, pnpm typecheck, pnpm test, pnpm build |
op-sdk |
pnpm typecheck, pnpm test, pnpm build |
sites |
pnpm check, pnpm build for each site |
CI does not run s3-test, kvm-*, vm-test, or web-e2e. Run whichever match your changes
locally. Pull requests from first-time contributors wait for a maintainer to approve the CI run.
Pre-release checks
Section titled “Pre-release checks”Unit tests don’t catch runtime packaging bugs like a missing binary on a systemd unit’s PATH, a
tight sandbox syscall failure, a Nix vendoring break, or an iOS-only compile error. Run two gates
before cutting a release:
just preflight— builds the node OS and guest image (verifying kernel config and Nix vendoring), runs config apply-mode tests, and checks the iOS library build.just kvm-e2e --dev --smoke --garage-store— boots real node services with/dev/kvm, starts a machine, checkpoints to Garage, and restores.
Even after both pass, always upgrade one replica first (anastroctl cluster upgrade -n <node>) and
verify it before rolling out to the rest of the cluster.