package store import ( "testing" "time" ) func TestConcurrencyRetryAfterBoundsPolling(t *testing.T) { if got := concurrencyRetryAfter(time.Time{}); got != 5*time.Second { t.Fatalf("zero expiry retry=%s, want=5s", got) } if got := concurrencyRetryAfter(time.Now().Add(30 * time.Second)); got != 5*time.Second { t.Fatalf("distant expiry retry=%s, want=5s", got) } got := concurrencyRetryAfter(time.Now().Add(2500 * time.Millisecond)) if got < 2*time.Second || got > 2500*time.Millisecond { t.Fatalf("near expiry retry=%s, want within [2s,2.5s]", got) } }