Skip to content

Commit

Permalink
with quietWait(), we can guarantee the end state of panicked executor…
Browse files Browse the repository at this point in the history
… contexts
  • Loading branch information
mumbleskates committed Sep 24, 2024
1 parent cfd2806 commit 401dbd7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions safety_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 401dbd7

Please sign in to comment.