Skip to content

est(shipment): add rate-limit boundary regression tests#415

Merged
dinahmaccodes merged 1 commit into
Navin-xmr:mainfrom
CHEF-SAVY:feat/Add-regression-tests-for-status-update-rate-limiting
May 30, 2026
Merged

est(shipment): add rate-limit boundary regression tests#415
dinahmaccodes merged 1 commit into
Navin-xmr:mainfrom
CHEF-SAVY:feat/Add-regression-tests-for-status-update-rate-limiting

Conversation

@CHEF-SAVY
Copy link
Copy Markdown
Contributor

Closes #367

Add regression tests for status update rate limiting

Extends rate-limit coverage with boundary tests around min_status_update_interval (default 60s).

What changed

  • Added setup_in_transit_shipment helper to isolate boundary tests from the first-update path
  • 4 new tests in test.rs:
    • Exact boundary (60s elapsed) → allowed
    • One second before (59s elapsed) → RateLimitExceeded
    • One second after (61s elapsed) → allowed
    • Admin with 0s elapsed → allowed (bypass documented by test)

Why
The < comparison in update_status makes the exact boundary non-obvious. These tests pin the
deterministic behaviour so any future change to the interval check will cause an explicit test
failure.

- test_rate_limit_boundary_exact_interval_is_allowed: update at exactly
  min_status_update_interval (60s) must succeed
- test_rate_limit_boundary_one_second_before_is_blocked: update at 59s
  must return RateLimitExceeded
- test_rate_limit_boundary_one_second_after_is_allowed: update at 61s
  must succeed
- test_rate_limit_admin_bypasses_interval: admin update with 0s elapsed
  must succeed, documenting the intentional bypass

All tests use setup_in_transit_shipment helper to isolate boundary
behaviour from the first-update path.
@dinahmaccodes dinahmaccodes merged commit 70d5446 into Navin-xmr:main May 30, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CONTRACT] Add regression tests for status update rate limiting

2 participants