MCPcopy
hub / github.com/bsm/redislock / assertTTL

Function assertTTL

redislock_test.go:490–505  ·  view source on GitHub ↗
(t *testing.T, lock *Lock, exp time.Duration)

Source from the content-addressed store, hash-verified

488}
489
490func assertTTL(t *testing.T, lock *Lock, exp time.Duration) {
491 t.Helper()
492
493 ttl, err := lock.TTL(t.Context())
494 if err != nil {
495 t.Fatal(err)
496 }
497
498 delta := ttl - exp
499 if delta < 0 {
500 delta = -delta
501 }
502 if delta > time.Second {
503 t.Fatalf("expected ~%v, got %v", exp, ttl)
504 }
505}
506
507var errFlaky = errors.New("flaky scripter: injected failure")
508

Callers 4

TestClientFunction · 0.85
TestLock_RefreshFunction · 0.85

Calls 1

TTLMethod · 0.80

Tested by

no test coverage detected