docs/README_TESTING.md
This project uses a two-tier testing approach to balance speed and thoroughness.
Testing Philosophy: For guidance on what to test, anti-patterns to avoid, and target metrics, see TESTING_PHILOSOPHY.md.
go test -short ./...
//go:build integration tagbeads_hash_multiclone_test.go - Multi-clone convergence tests (~13s)beads_integration_test.go - End-to-end scenariosbeads_multidb_test.go - Multi-database testsgo test -tags=integration ./...
PR Checks (fast, runs on every PR):
go test -short -race ./...
Nightly (comprehensive, runs overnight):
go test -tags=integration -race ./...
No special setup required. Just write the test normally.
Add build tags at the top of the file:
//go:build integration
// +build integration
package yourpackage_test
Mark slow operations with testing.Short() check:
func TestSomethingSlow(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
// ... slow test code
}
During development, run fast tests frequently:
go test -short ./...
Before committing, run full suite:
go test -tags=integration ./...
Git-heavy integration tests use testutil.TempDirInMemory() to reduce I/O overhead:
import "github.com/steveyegge/beads/internal/testutil"
func TestWithGitOps(t *testing.T) {
tmpDir := testutil.TempDirInMemory(t)
// ... test code using tmpDir
}
Platform behavior:
/dev/shm (tmpfs ramdisk) if available - provides 20-30% speedup/tmp (APFS is already fast)For CI (GitHub Actions):
Linux runners automatically have /dev/shm available, so no configuration needed.