Skip to content

fix(tests): stop CI-only rate-limit flake in the integration suite - #10

Merged
tthanhtung92 merged 1 commit into
mainfrom
fix-ratelimit-test-flake
Aug 5, 2026
Merged

fix(tests): stop CI-only rate-limit flake in the integration suite#10
tthanhtung92 merged 1 commit into
mainfrom
fix-ratelimit-test-flake

Conversation

@tthanhtung92

Copy link
Copy Markdown
Owner

Summary

Follow-up to the RateLimitingTests isolation fix (already merged in #9). That fix stopped RateLimitingTests' own burst from poisoning the shared ApiCollection fixture's quota, but CI still failed: 5 integration tests failed with 429 on their first login, all through FinmyApiFactory.GetAccessTokenAsync.

Root cause: on a resource-constrained CI runner, ordinary register+login traffic from several test classes each needing their first token (plus retry-on-failure in the caching path) was enough on its own to reach the production auth ceiling (10 per 60s). Once exhausted, every later test needing a fresh login in that window failed the same way.

Fix

  • FinmyApiFactory.ConfigureWebHost now sets RateLimiting:AuthPermitLimit to a practically unlimited default for every test host, so ordinary test traffic never realistically hits it.
  • RateLimitingTests opts back into the real production ceiling (10) on its own isolated host via WithWebHostBuilder, so it still tests the actual limit rather than the relaxed default.

Verification

  • dotnet build Finmy.slnx — 0 errors, 0 warnings.
  • dotnet test Finmy.slnx — 107/107 passing locally.
  • Watching this PR's CI to confirm the fix holds under the same resource constraints that surfaced it.

…uth rate limit

Isolating RateLimitingTests (previous commit) stopped its own burst
from poisoning other tests' quota, but CI still failed: on a
resource-constrained runner, ordinary register+login traffic from
several test classes needing their first token was enough on its own
to bump into the production auth ceiling (10 per 60s), cascading into
every later test failing the same way once the window was exhausted.

FinmyApiFactory now sets RateLimiting:AuthPermitLimit to a practically
unlimited default for every test host. RateLimitingTests opts back
into the real production ceiling on its own isolated host via
WithWebHostBuilder, so it still tests the real limit rather than the
relaxed default.
@tthanhtung92
tthanhtung92 merged commit 973756e into main Aug 5, 2026
3 checks passed
@tthanhtung92
tthanhtung92 deleted the fix-ratelimit-test-flake branch August 5, 2026 08:06
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.

1 participant