Skip to content

test(controller): add goleak test cases to detect goroutine leaks #1810

Open
dongjiang1989 wants to merge 1 commit intokagent-dev:mainfrom
dongjiang1989:fix/memory-leaks
Open

test(controller): add goleak test cases to detect goroutine leaks #1810
dongjiang1989 wants to merge 1 commit intokagent-dev:mainfrom
dongjiang1989:fix/memory-leaks

Conversation

@dongjiang1989
Copy link
Copy Markdown
Contributor

Summary

  • Add goleak verification to the controller package test suite via TestMain, ensuring goroutine leaks are detected across all controller tests
  • Add goleak coverage to the MCP server reconciler tests
  • Prevent silent goroutine leaks from accumulating in the reconciliation loop

Test plan

  • go test ./go/core/internal/controller/... — goleak runs automatically on every test
  • go test ./go/core/internal/controller/reconciler/... — reconciler goleak tests pass

Signed-off-by: dongjiang <dongjiang1989@126.com>
Copilot AI review requested due to automatic review settings May 7, 2026 09:47
@github-actions github-actions Bot added the testing Additional testing required label May 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds go.uber.org/goleak to the Go module and wires it into controller-related test suites via TestMain, aiming to detect goroutine leaks during tests (notably around reconciler behavior).

Changes:

  • Add go.uber.org/goleak dependency.
  • Enable goleak verification for controller package tests via a new TestMain.
  • Enable goleak verification for reconciler package tests via TestMain in the MCP server reconciler test file.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
go/go.mod Adds the go.uber.org/goleak dependency.
go/core/internal/controller/goleak_test.go Adds package-level TestMain to run goleak verification for controller tests.
go/core/internal/controller/reconciler/mcp_server_reconciler_test.go Adds goleak TestMain for reconciler package tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/core/internal/controller/goleak_test.go
@dongjiang1989
Copy link
Copy Markdown
Contributor Author

cc @EItanya PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Additional testing required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants