chore(act): group log lines when running act tests inside gha#488
chore(act): group log lines when running act tests inside gha#488
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modifies the act test logging system to improve readability when running tests inside GitHub Actions. The changes buffer all log output (stdout and stderr) from each test runner and print them in collapsible GitHub Actions log groups, preventing interleaved output from parallel tests.
Changes:
- Added
WithName()option to configure custom runner names for logging - Modified stream handling to merge stdout and stderr for unified log grouping
- Removed debug logging statements (
t.Log,t.Logf) from test files - Implemented buffering system that groups logs by runner in GitHub Actions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/act/main_test.go | Added WithName("toolcache-warmup") to warmup runner for clearer log identification |
| tests/act/main_smoke_test.go | Removed debug t.Log() statement to reduce log clutter |
| tests/act/main_package_test.go | Removed debug t.Logf() statements for cleaner output |
| tests/act/internal/act/act.go | Core changes: added name field, merged stdout/stderr pipes, implemented log buffering and GHA grouping, added mutex for thread-safe group printing |
Comments suppressed due to low confidence (1)
tests/act/internal/act/act.go:157
- The
namefield is never initialized with a default value. WhenWithName()is not called,r.namewill be an empty string, which will result in empty or malformed log output at lines 434, 447, 464, and 483.
The documentation at lines 48-49 states "By default, this is t.Name()", but this default is never set. Add initialization in NewRunner after line 152 to set r.name = t.Name() so that the field has a sensible default when WithName() is not explicitly called.
r := &Runner{
t: t,
uuid: uuid.New(),
gitHubToken: ghToken,
inGitHubActions: os.Getenv("GITHUB_ACTIONS") == "true",
GCOM: newGCOM(t),
Argo: NewHTTPSpy(t, map[string]string{
"uri": "https://mock-argo-workflows.example.com/workflows/grafana-plugins-cd/mock-workflow-id",
}),
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes the log system for act tests when running inside GHA. Group all log lines (stdout + stderr) from each runner in its own GHA group. Since tests run in parallel, it's very hard to tell what's going on as each runner used to print to stdout as soon as possible.
Before: https://github.com/grafana/plugin-ci-workflows/actions/runs/20783693980/job/59687286367
After: https://github.com/grafana/plugin-ci-workflows/actions/runs/20817094834/job/59795443100?pr=488