From 401dbd721f2f964a38b2a80bb721d4960d27e741 Mon Sep 17 00:00:00 2001 From: Kent Ross Date: Tue, 24 Sep 2024 13:47:12 -0700 Subject: [PATCH] with quietWait(), we can guarantee the end state of panicked executor contexts --- safety_test.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/safety_test.go b/safety_test.go index ae2b437..aa87683 100644 --- a/safety_test.go +++ b/safety_test.go @@ -97,7 +97,8 @@ func TestCollectorCleanup(t *testing.T) { for range valuePipe { // The channel should get closed! } - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t) // the cancelation error is inconsistent here, + // depending on whether the pipe group or the executor was reaped first } func TestFeederCleanup(t *testing.T) { @@ -119,7 +120,8 @@ func TestFeederCleanup(t *testing.T) { for range valuePipe { // The channel should get closed! } - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t) // the cancelation error is inconsistent here, + // depending on whether the pipe group or the executor was reaped first } func TestGatherErrCleanup(t *testing.T) { @@ -141,7 +143,8 @@ func TestGatherErrCleanup(t *testing.T) { for range valuePipe { // The channel should get closed! } - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t) // the cancelation error is inconsistent here, + // depending on whether the pipe group or the executor was reaped first } func TestCollectWithErrsCleanup(t *testing.T) { @@ -163,7 +166,8 @@ func TestCollectWithErrsCleanup(t *testing.T) { for range valuePipe { // The channel should get closed! } - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t) // the cancelation error is inconsistent here, + // depending on whether the pipe group or the executor was reaped first } func TestFeedWithErrsCleanup(t *testing.T) { @@ -186,7 +190,8 @@ func TestFeedWithErrsCleanup(t *testing.T) { for range valuePipe { // The channel should get closed! } - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t) // the cancelation error is inconsistent here, + // depending on whether the pipe group or the executor was reaped first } func TestPanicGroup(t *testing.T) { @@ -303,7 +308,7 @@ func TestPanicFeedFunction(t *testing.T) { return 1, nil }) assertPanicsWithValue(t, "oh no!", func() { _ = g.Wait() }) - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t, errPanicked) } func TestPanicFeedWork(t *testing.T) { @@ -369,7 +374,7 @@ func TestPanicFeedErrFunction(t *testing.T) { return 1, nil }) assertPanicsWithValue(t, "oh no!", func() { _ = g.Wait() }) - leak.assertAllCanceled(t) // the cancelation error is inconsistent here + leak.assertAllCanceled(t, errPanicked) } func TestPanicFeedErrWork(t *testing.T) {