Skip to content

test(daemon): enable goleak-based goroutine leak detection harness#127

Open
kangeunchan wants to merge 2 commits intoaltuslabsxyz:mainfrom
kangeunchan:test/goleak-daemon-harness
Open

test(daemon): enable goleak-based goroutine leak detection harness#127
kangeunchan wants to merge 2 commits intoaltuslabsxyz:mainfrom
kangeunchan:test/goleak-daemon-harness

Conversation

@kangeunchan
Copy link
Collaborator

Enhancement Description

Enable goleak-based goroutine leak detection in daemon test harnesses to prevent cleanup regressions.

Summary

This PR adds goleak.VerifyTestMain to key daemon packages and applies a minimal allowlist for known safe exceptions.

Previously, goroutine leaks could pass silently in concurrency-heavy packages:

  • lifecycle cleanup regressions were harder to catch
  • leak detection was not consistently enforced in daemon tests

Now leak checks run automatically in targeted test packages.

What Changed

1) Added goleak TestMain harnesses

Added:

  • internal/daemon/controller/main_test.go
  • internal/daemon/server/main_test.go
  • internal/daemon/runtime/main_test.go

2) Added scoped allowlist for known server test path

  • allowlisted known safe/expected goroutine path in server test harness
  • kept allowlist narrow to avoid masking new leaks

3) Added dependency and required test formatting updates

Updated:

  • go.mod / go.sum
  • internal/daemon/runtime/service_launchd_test.go

4) Tests

Leak-aware test runs were added for targeted daemon packages.

Why This Is Needed

This is a test reliability improvement for concurrency-heavy code.
Automatic leak detection catches lifecycle regressions before merge.

Behavior Notes / Regression Impact

No runtime feature behavior change.
Only test harness strictness is increased.

Validation Performed

  • go test ./internal/daemon/controller -count=1
  • go test ./internal/daemon/server -count=1
  • go test ./internal/daemon/runtime -count=1
  • go test ./...
  • golangci-lint run

Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant