(t *testing.T, lock *Lock, exp time.Duration)
| 488 | } |
| 489 | |
| 490 | func 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 | |
| 507 | var errFlaky = errors.New("flaky scripter: injected failure") |
| 508 |
no test coverage detected