MCPcopy Index your code
hub / github.com/riverqueue/river / TestErrStop

Function TestErrStop

rivershared/startstop/start_stop_test.go:189–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestErrStop(t *testing.T) {
190 t.Parallel()
191
192 var workCtx context.Context
193
194 startStop := StartStopFunc(func(ctx context.Context, shouldStart bool, started, stopped func()) error {
195 if !shouldStart {
196 return nil
197 }
198
199 workCtx = ctx //nolint:fatcontext
200
201 go func() {
202 started()
203 defer stopped()
204 <-ctx.Done()
205 }()
206
207 return nil
208 })
209
210 ctx := context.Background()
211
212 require.NoError(t, startStop.Start(ctx))
213 <-startStop.Started()
214 startStop.Stop()
215 require.ErrorIs(t, context.Cause(workCtx), ErrStop)
216}
217
218// BaseStartStop tests that need specific internal implementation (like ones we
219// can add to sampleService) to be able to verify.

Callers

nothing calls this directly

Calls 5

StartStopFuncFunction · 0.85
DoneMethod · 0.80
StartMethod · 0.65
StartedMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…