Skip to main content

Reset a seeded environment

Seeding is slow. Do it once, snapshot, and reset from the snapshot for the rest of the project's life.

Runs against the demo project.

1. Seed everything, once​

Schema and reference data
docker compose exec -T postgres psql -U postgres -d demo <<'SQL'
CREATE TABLE tenants (id serial PRIMARY KEY, name text NOT NULL);
CREATE TABLE orders (id serial PRIMARY KEY, tenant_id int REFERENCES tenants(id), total numeric);
INSERT INTO tenants (name) VALUES ('acme'), ('globex'), ('initech');
INSERT INTO orders (tenant_id, total) SELECT (n % 3) + 1, n * 1.5 FROM generate_series(1, 5000) n;
SQL
Uploaded files
docker compose exec -T minio sh -c '
mkdir -p /data/demo/invoices
for i in 1 2 3; do echo "invoice $i" > /data/demo/invoices/inv-$i.txt; done
'
A warm cache
docker compose exec -T redis redis-cli MSET \
tenants:count 3 orders:count 5000 cache:warmed 1

2. Capture the baseline​

arcave savepoint create clean --description "seeded baseline — do not delete"
stderr + stdout
✔ savepoint.create clean 10.6s
├── ✔ project.introspect 0.1s
├── ✔ savepoint.hold 0.2s
├── ✔ savepoint.capture clean 5.7s
└── ✔ savepoint.release 3.6s

Savepoint clean · 019e83ff-30c0-7000-8000-000000000000 · 18:36:40 · stored 273 MB
count size stored
volumes 3 49.2 MB 4.7 MB
layers 3 260 MB 40.6 KB
images 3 1.1 GB 268 MB

roll back: arcave -p arcave-demo rollback clean

Three volumes, three writable layers, three images, one savepoint. The JSON is trimmed to the fields that identify each entry; Roll back a failed migration shows one of each in full.

3. Let a test suite make a mess​

docker compose exec -T postgres psql -U postgres -d demo -c 'TRUNCATE orders CASCADE;'
docker compose exec -T minio sh -c 'rm -rf /data/demo/invoices'
docker compose exec -T redis redis-cli FLUSHALL

4. Reset​

arcave rollback clean

5. Verify all three came back​

docker compose exec -T postgres psql -U postgres -d demo -tAc 'SELECT count(*) FROM orders;'
5000
docker compose exec -T minio sh -c 'ls /data/demo/invoices'
inv-1.txt
inv-2.txt
inv-3.txt
docker compose exec -T redis redis-cli MGET tenants:count orders:count cache:warmed
1) "3"
2) "5000"
3) "1"

This is the point of whole-project capture. A pg_restore would have given you the first of those three, and left the object store empty and the cache cold.

6. Wire it into the test suite​

run-tests.sh
#!/usr/bin/env bash
set -euo pipefail

export ARCAVE_COMPOSE_PROJECT_NAME=arcave-demo

arcave rollback clean # reset BEFORE, not after
./integration-tests.sh

Resetting before rather than after has two advantages: a crashed suite cannot skip its own cleanup, and you can inspect the wreckage of a failed run before the next one wipes it.

7. Protect the baseline​

arcave savepoint list
stdout
NAME ID CREATED VOLUMES LAYERS STORED NOT COVERED
after-refactor 019e8488-3ac8-7000-8000-000000000000 2026-06-01 21:13 3 3 49.3 MB -
clean 019e83ff-30c0-7000-8000-000000000000 2026-06-01 18:36 3 3 273 MB -
warning

arcave savepoint remove --retain-recent 5 will delete clean once five newer savepoints exist. Retention rules do not know which savepoint is precious.

Remove by name instead, and let arcave gc free the space:

arcave savepoint remove after-refactor
arcave gc

Or keep the baseline in a session of its own. Retention works within one session, so no sweep in the session you work in can reach it:

arcave session create --name fixtures
arcave --session fixtures savepoint create clean --description "seeded baseline — do not delete"
run-tests.sh, resetting from the fixtures session
arcave --session fixtures rollback clean
./integration-tests.sh

Take the savepoint right after seeding, as in step 2. The commands that name no session keep working in yours, and arcave savepoint remove --retain-recent 5 there never sees clean.

Tools and expertise for reproducible, production-like environments.
Copyright © 2026 Greenmask, Inc.
Privacy Policy