Skip to content

Commit 0af54b4

Browse files
committed
mcp: use github.com/uber-go/goleak to test for leaks in unit tests
1 parent b636b16 commit 0af54b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mcp/cmd_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
"github.com/google/go-cmp/cmp"
2020
"github.com/modelcontextprotocol/go-sdk/mcp"
21+
"go.uber.org/goleak"
2122
)
2223

2324
const runAsServer = "_MCP_RUN_AS_SERVER"
@@ -35,6 +36,8 @@ func SayHi(ctx context.Context, req *mcp.CallToolRequest, args SayHiParams) (*mc
3536
}
3637

3738
func TestMain(m *testing.M) {
39+
goleak.VerifyTestMain(m)
40+
3841
// If the runAsServer variable is set, execute the relevant serverFunc
3942
// instead of running tests (aka the fork and exec trick).
4043
if name := os.Getenv(runAsServer); name != "" {

0 commit comments

Comments
 (0)