code-rules-test-library › Testing practices/testing

Verify retry limits

MEDIUM3.0.0
When to apply When adding or changing retries.

Rule

Test that every retry policy stops after at most 2 attempts, with a test at the limit. Use a fake clock. See the retry lifecycle.

Evidence

A test exercises the limit for each retry policy. Also cover jittered policies with the same test.

Example: Python

Use tenacity with stop_after_attempt(3).