summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-22 22:31:58 +0200
committerPaul Buetow <paul@buetow.org>2026-02-22 22:31:58 +0200
commit401081215588cc15af3407681a0b2bc7199818af (patch)
tree9e1161f9d72ca760052c8d7f81ecf3389eac6194
parent4cd2c4e818a1438bf63d1ca05a6cf134f39bc06b (diff)
Add heartbeat progress logs for integration test runs
-rw-r--r--Magefile.go28
1 files changed, 26 insertions, 2 deletions
diff --git a/Magefile.go b/Magefile.go
index 33db267..3f4952b 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -14,6 +14,7 @@ import (
"path/filepath"
"slices"
"strings"
+ "time"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
@@ -101,7 +102,9 @@ func TestWithName() error {
fmt.Println("Running integration test", testName, "(requires root)...")
env := goEnv()
forwardEnv(env, "HOME", "GOPATH", "GOMODCACHE", "PATH")
- return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-run", "^"+testName+"$", "-v", "-failfast", "-count=1")
+ return runWithHeartbeat(15*time.Second, "Integration test still running...", func() error {
+ return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-run", "^"+testName+"$", "-v", "-failfast", "-count=1")
+ })
}
return sh.RunWithV(goEnv(), "go", "test", "./...", "-run", "^"+testName+"$", "-v", "-failfast")
}
@@ -263,7 +266,9 @@ func IntegrationTest() error {
fmt.Println("Running integration tests (requires root)...")
env := goEnv()
forwardEnv(env, "HOME", "GOPATH", "GOMODCACHE")
- return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-v", "-failfast", "-count=1")
+ return runWithHeartbeat(15*time.Second, "Integration tests still running...", func() error {
+ return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-v", "-failfast", "-count=1")
+ })
}
func buildWorkloadBinary() error {
@@ -534,6 +539,25 @@ func sortLinesWithLocale(lines []string) (string, error) {
return string(output), nil
}
+func runWithHeartbeat(interval time.Duration, message string, fn func() error) error {
+ done := make(chan struct{})
+ go func() {
+ ticker := time.NewTicker(interval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-done:
+ return
+ case <-ticker.C:
+ fmt.Println(message)
+ }
+ }
+ }()
+ err := fn()
+ close(done)
+ return err
+}
+
func isIntegrationTest(testName string) (bool, error) {
out, err := sh.OutputWith(goEnv(), "go", "test", "./integrationtests/...", "-list", ".")
if err != nil {