MCPcopy
hub / github.com/gofiber/fiber / TestDefaultCtx_ScheduleReclaim_NilCancel

Function TestDefaultCtx_ScheduleReclaim_NilCancel

ctx_reclaim_test.go:89–102  ·  view source on GitHub ↗

TestDefaultCtx_ScheduleReclaim_NilCancel exercises the cancel==nil branch.

(t *testing.T)

Source from the content-addressed store, hash-verified

87
88// TestDefaultCtx_ScheduleReclaim_NilCancel exercises the cancel==nil branch.
89func TestDefaultCtx_ScheduleReclaim_NilCancel(t *testing.T) {
90 t.Parallel()
91 app, c := acquireReclaimTestCtx(t)
92
93 handlerDone := make(chan struct{})
94 c.ScheduleReclaim(handlerDone, nil)
95
96 close(handlerDone)
97 app.ReleaseCtx(c)
98
99 require.Eventually(t, func() bool {
100 return !c.IsAbandoned()
101 }, time.Second, 5*time.Millisecond, "nil cancel must not block reclamation")
102}
103
104// TestDefaultCtx_signalReleased_NoReclaim guards that calling signalReleased on
105// a context that was never armed for reclamation is a safe no-op. This is the

Callers

nothing calls this directly

Calls 4

acquireReclaimTestCtxFunction · 0.85
ReleaseCtxMethod · 0.80
ScheduleReclaimMethod · 0.65
IsAbandonedMethod · 0.65

Tested by

no test coverage detected