TestDefaultCtx_ScheduleReclaim_HappyPath covers the dominant timed-out flow: after ScheduleReclaim is armed and both signals fire (handlerDone closes and the request handler releases the context), the context is returned to the pool, observable as IsAbandoned flipping back to false.
(t *testing.T)
| 30 | // the request handler releases the context), the context is returned to the |
| 31 | // pool, observable as IsAbandoned flipping back to false. |
| 32 | func TestDefaultCtx_ScheduleReclaim_HappyPath(t *testing.T) { |
| 33 | t.Parallel() |
| 34 | app, c := acquireReclaimTestCtx(t) |
| 35 | |
| 36 | handlerDone := make(chan struct{}) |
| 37 | c.ScheduleReclaim(handlerDone, nil) |
| 38 | require.True(t, c.IsAbandoned(), "ScheduleReclaim must Abandon the ctx internally") |
| 39 | |
| 40 | close(handlerDone) |
| 41 | require.True(t, c.IsAbandoned(), "ctx must stay abandoned until ReleaseCtx fires") |
| 42 | |
| 43 | app.ReleaseCtx(c) |
| 44 | require.Eventually(t, func() bool { |
| 45 | return !c.IsAbandoned() |
| 46 | }, time.Second, 5*time.Millisecond, "ctx must be reclaimed once both signals fire") |
| 47 | } |
| 48 | |
| 49 | // TestDefaultCtx_ScheduleReclaim_ReleaseBeforeHandlerDone covers the reverse |
| 50 | // ordering: ReleaseCtx is called first, then handlerDone closes. The reclaim |
nothing calls this directly
no test coverage detected