test(controller): add goleak test cases to detect goroutine leaks #1810
test(controller): add goleak test cases to detect goroutine leaks #1810dongjiang1989 wants to merge 1 commit intokagent-dev:mainfrom
Conversation
There was a problem hiding this comment.
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/goleakdependency. - Enable goleak verification for
controllerpackage tests via a newTestMain. - Enable goleak verification for
reconcilerpackage tests viaTestMainin 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.
|
cc @EItanya PTAL |
EItanya
left a comment
There was a problem hiding this comment.
Adding a leak checker makes sense, but I'm not quite sure why you decided to put it in the spots you did.
Signed-off-by: dongjiang <dongjiang1989@126.com>
4d52af1 to
8156781
Compare
Thanks @EItanya The |
Summary
goleakverification to the controller package test suite viaTestMain, ensuring goroutine leaks are detected across all controller testsTest plan
go test ./go/core/internal/controller/...— goleak runs automatically on every testgo test ./go/core/internal/controller/reconciler/...— reconciler goleak tests pass