summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md3
-rw-r--r--Magefile.go16
2 files changed, 17 insertions, 2 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 9fc309d..6558be1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -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")