MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestRetryLoopContextDeadline

Function TestRetryLoopContextDeadline

base/util_test.go:267–281  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265}
266
267func TestRetryLoopContextDeadline(t *testing.T) {
268 var invoked atomic.Bool
269 worker := func() (shouldRetry bool, err error, value any) {
270 invoked.Store(true)
271 return true, nil, nil
272 }
273
274 ctx, cancelFunc := context.WithTimeout(TestCtx(t), 50*time.Millisecond)
275 defer cancelFunc()
276
277 err, _ := RetryLoop(ctx, t.Name(), worker, CreateIndefiniteMaxDoublingSleeperFunc(10, 100))
278 require.ErrorContains(t, err, "timed out based on context")
279 require.ErrorIs(t, err, context.DeadlineExceeded)
280 require.ErrorIs(t, ctx.Err(), context.DeadlineExceeded)
281}
282
283func TestSyncSourceFromURL(t *testing.T) {
284 u, err := url.Parse("http://www.test.com:4985/mydb")

Callers

nothing calls this directly

Calls 6

TestCtxFunction · 0.85
RetryLoopFunction · 0.85
StoreMethod · 0.80
ErrMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected