Skip to main content

Contributing

Building

Project Structure

Running Tests

Unit Tests

Unit tests cover:
  • dag/ — Merkle tree construction, object pool CRUD, store CRUD, verification
  • state/ — State file round-trip, path resolution, schema versioning
  • volume/ — rsync clone, hardlinks, excludes, permissions
  • docker/ — Client validation (skipped if Docker unavailable)
  • cli/ — Formatter functions

End-to-End Tests

E2E tests require a running Docker environment and are gated behind GRAFT_E2E=1:
The e2e tests:
  1. Start a real Postgres 16 container with a named volume
  2. Run the graft CLI binary against it
  3. Assert state.json, graft.db, and objects/ are correctly populated
  4. Test branch creation, commit, verify, checkout, rollback, and delete
The first test run takes ~60 seconds (Docker image pull + Postgres startup).

E2E Test Smoke Test

TestE2ESmokeCLI runs every CLI subcommand against a real Postgres container, including:
  • graft init with volume selection
  • graft commit with sync hashing
  • graft verify on clean and dirty trees
  • graft checkout for new and existing branches
  • graft rollback to rewind state
  • graft delete to clean up
  • graft list to verify output formats