Repository navigation
test(api): the browser suite is not held to the API's read quota - #515
Merged
Merged
Conversation
Each step of a browser test reloads the whole application, and the owner's page then read 409 times in a minute, from the one address every simulated user shares, against a quota of 300 per account and 600 per network. Whichever read came past the quota was refused with a 429; when it was the organization list of the token form, the test waited for an option that never came (seen on main at b425efe and twice on #512, and locally one run in three or four). The browser fixture replaces the throttle with one that lets the 'api' attempt through and keeps every credential limit. The quota keeps its own tests in identity-throttle.integration.spec.ts. Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What changed
The browser fixture gives the API a throttle that lets the
apiattempt through, the read quota of 300 requests a minute per account and 600 per network. Every other limit applies as in production: login, registration, mail, MFA and token proofs.BrowserSuiteThrottle(insrc/testing/) extendsPrismaIdentityThrottle. It answersapiwith an allowed decision and passes every other attempt to the real store.integrationAppaccepts a provider override by class ({ token, useClass }), next to the existing override by value, so Nest builds the throttle with its dependencies.browserAppputs that override first, and a test's own overrides still come after it.Why
tenant.browser.spec.ts › creates scoped tokens the API accepts, and revokes a project tokenfailed intermittently:b425efe;Each failure was a different 15-second wait: the Create API token button,
#token-projectand#token-organization.I logged every API request and every 429 of the file:
GET /api/v1/organizations. The token form's organization list stayed empty, and Playwright waited for an option that never came. Passing runs got their 429s on requests the page retries.goto, and each load reads about ten resources. The owner's page made 409 requests in its busiest minute, against a quota of 300 per account. All pages together made 576 from127.0.0.1, plus the test's owncontext.requestcalls, against 600 per network.The browser suite checks screens, not the quota, and a person cannot click at that rate. The quota keeps its own integration tests (
identity-throttle.integration.spec.ts,api-token-authentication.integration.spec.ts). The only 429 a browser test checks, insecurity.browser.spec.ts, is simulated by intercepting the response in the browser, and is unaffected.How it was tested
tenant.browser.spec.ts, four runs in a row: 13/13 each time. Before the change, the same command failed one run in three, then one in four.api:typecheckandapi:lintpass.Security considerations
Test code only: the production throttle and its policy are unchanged. Credential limits still apply in the browser suite.