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

Function acquireReclaimTestCtx

ctx_reclaim_test.go:19–26  ·  view source on GitHub ↗

acquireReclaimTestCtx wires up a *DefaultCtx for reclaim tests without going through a full request lifecycle, so each test can drive ScheduleReclaim, signalReleased, and ReleaseCtx in isolation.

(t *testing.T)

Source from the content-addressed store, hash-verified

17// through a full request lifecycle, so each test can drive ScheduleReclaim,
18// signalReleased, and ReleaseCtx in isolation.
19func acquireReclaimTestCtx(t *testing.T) (*App, *DefaultCtx) {
20 t.Helper()
21 app := New()
22 raw := app.AcquireCtx(&fasthttp.RequestCtx{})
23 dc, ok := raw.(*DefaultCtx)
24 require.True(t, ok, "AcquireCtx must return *DefaultCtx in tests")
25 return app, dc
26}
27
28// TestDefaultCtx_ScheduleReclaim_HappyPath covers the dominant timed-out flow:
29// after ScheduleReclaim is armed and both signals fire (handlerDone closes and

Calls 2

AcquireCtxMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected