TestDefaultCtx_signalReleased_Idempotent guards the sync.Once semantics: even if the request release path fires multiple times, the latch must close once.
(t *testing.T)
| 114 | // TestDefaultCtx_signalReleased_Idempotent guards the sync.Once semantics: even |
| 115 | // if the request release path fires multiple times, the latch must close once. |
| 116 | func TestDefaultCtx_signalReleased_Idempotent(t *testing.T) { |
| 117 | t.Parallel() |
| 118 | app, c := acquireReclaimTestCtx(t) |
| 119 | |
| 120 | handlerDone := make(chan struct{}) |
| 121 | c.ScheduleReclaim(handlerDone, nil) |
| 122 | |
| 123 | require.NotPanics(t, func() { |
| 124 | c.signalReleased() |
| 125 | c.signalReleased() |
| 126 | c.signalReleased() |
| 127 | }) |
| 128 | |
| 129 | close(handlerDone) |
| 130 | require.Eventually(t, func() bool { |
| 131 | return !c.IsAbandoned() |
| 132 | }, time.Second, 5*time.Millisecond, "ctx must still be reclaimed exactly once") |
| 133 | |
| 134 | _ = app |
| 135 | } |
| 136 | |
| 137 | // TestApp_releaseDefaultCtx_AbandonedSignalsReclaim exercises the internal |
| 138 | // releaseDefaultCtx path (called by defaultRequestHandler's defer) for an |
nothing calls this directly
no test coverage detected