diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-14 10:43:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-14 10:43:33 +0300 |
| commit | 9d32b8138baf821d72eb1f5a7a218f9b1949c853 (patch) | |
| tree | ecb4884f72d425b63e2f1039bf018732ecfe0598 | |
| parent | aad908c3b71f2a99898e0b0820625ddd40a986f3 (diff) | |
Enable race tests in mage automation (p3)
- Test runs unit tests then race detector via mg.Deps
- Add TestRace target for race-only runs
- Document mage test vs testRace in AGENTS.md
Made-with: Cursor
| -rw-r--r-- | AGENTS.md | 3 | ||||
| -rw-r--r-- | Magefile.go | 16 |
2 files changed, 17 insertions, 2 deletions
@@ -13,7 +13,8 @@ go build -o goprecords ./cmd/goprecords # Run tests go test ./... -# or: mage test +# Full check (unit + race): mage test +# Race only: mage testRace # Run integration tests ./goprecords test diff --git a/Magefile.go b/Magefile.go index ac2f23e..742ffbf 100644 --- a/Magefile.go +++ b/Magefile.go @@ -23,11 +23,25 @@ func Build() error { return sh.RunV("go", "build", "-o", binaryName, "./cmd/goprecords") } -// Test runs all tests. +// Test runs all tests with the default race-free pass and again with the race detector. func Test() error { + mg.Deps(testUnit, testRace) + return nil +} + +func testUnit() error { return sh.RunV("go", "test", "./...") } +// TestRace runs tests with the race detector (-race). +func TestRace() error { + return testRace() +} + +func testRace() error { + return sh.RunV("go", "test", "-race", "./...") +} + // CoverMicroservice runs tests with coverage for daemon, authkeys, and cli, then prints per-function coverage (go tool cover -func). func CoverMicroservice() error { profile := filepath.Join(os.TempDir(), "goprecords-microservice.cover") |
