From 8b046b1b27d9cb7044def59a25510ed9a3add000 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 3 Feb 2022 16:41:11 -0800 Subject: [PATCH] Add more goroutine leak checks. --- regression_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/regression_test.go b/regression_test.go index 1b23ed98..dea451b0 100644 --- a/regression_test.go +++ b/regression_test.go @@ -12,11 +12,14 @@ import ( "github.com/creachadair/jrpc2/channel" "github.com/creachadair/jrpc2/handler" "github.com/creachadair/jrpc2/server" + "github.com/fortytw2/leaktest" ) // Verify that a notification handler will not deadlock with the dispatcher on // holding the server lock. See: https://github.com/creachadair/jrpc2/issues/27 func TestLockRaceRegression(t *testing.T) { + defer leaktest.Check(t)() + hdone := make(chan struct{}) local := server.NewLocal(handler.Map{ // Do some busy-work and then try to get the server lock, in this case @@ -56,6 +59,8 @@ func TestLockRaceRegression(t *testing.T) { // Verify that if a callback handler panics, the client will report an error // back to the server. See https://github.com/creachadair/jrpc2/issues/41. func TestOnCallbackPanicRegression(t *testing.T) { + defer leaktest.Check(t)() + const panicString = "the devil you say" loc := server.NewLocal(handler.Map{ @@ -91,6 +96,8 @@ func TestOnCallbackPanicRegression(t *testing.T) { // Verify that a duplicate request ID that arrives while a task is in flight // does not cause the existing task to be cancelled. func TestDuplicateIDCancellation(t *testing.T) { + defer leaktest.Check(t)() + tctx, cancel := context.WithCancel(context.Background()) defer cancel()