fix(tests): stop CI-only rate-limit flake in the integration suite - #10
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ConfigureWebHostnow setsRateLimiting:AuthPermitLimitto a practically unlimited default for every test host, so ordinary test traffic never realistically hits it.RateLimitingTestsopts back into the real production ceiling (10) on its own isolated host viaWithWebHostBuilder, 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.