Repository navigation
fix(auth): the database tests pass on a busy machine without timing out - #709
Draft
PiquelChips wants to merge 2 commits into
Draft
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
Tests that hold the signing key lock while they generate keys work in a database of their own, so the replicas other tests start no longer time out waiting for it. Database::isolated creates a database rather than a schema, since advisory locks are per database, so the signing-keys and audit test groups are no longer needed. Test pools wait up to a minute for a connection, the audit tests up to two minutes for sealing, and one delivery test's lease is long enough for a loaded machine. Production limits are unchanged. Closes #708
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
…limit Also says how to drop the test_ databases a run leaves on a server of your own, and that TEST_DATABASE_URL must never name a server that matters.
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.
On a busy machine, a full
just db testfailed a different handful of tests each run. Almost every failure had one cause. The signing key tests hold the database-wide signing key lock while they generate several 3072-bit RSA keys. Every replica that any test starts waits for that same lock, under the 15-second statement limit. Under load, key generation took longer than that, so tests that never touch signing keys failed as they started.What changed: only test fixtures and test files. Production code and its time limits are unchanged, and no test is skipped or weakened: all 509 tests run, as before.
A test that holds a database-wide lock gets a database of its own.
Database::isolatednow creates a database rather than a schema, because advisory locks are per database. The signing key tests, the admin signing key test and the dashboard's rotate-and-revoke test use it. The audit tests already did, so each now has its own audit locks. Creating the database has no statement limit, on its setup connection only, since copying the template database can take longer on a loaded disk.The
signing-keysandaudittest groups are gone. Their tests no longer share a lock with each other.Waits that only set a test up are long enough for a loaded machine. These waits are setup, not what the test checks:
Database::TEST_ACQUIRE_TIMEOUT, through oneDatabase::test_config. ThePoolTimedOutand "migrate: timed out" failures were this.operators_retry_and_cancel_deliveriesuses a 5-second lease instead of 300 ms. The lease is a window the test picks, not a limit.The one test that asserts the service's 5-second pool wait keeps it.
No concurrency cap: connections never ran short. At the default 16 threads, the cluster peaked at 89–120 client connections of its 400, so
test-threadsstays at the default.docs/dev/testing.mdnow says when a test needs a database of its own, which waits a test may lengthen, and how to drop thetest_databases a run leaves on a server of your own.Proof: each run is the full suite at the default thread count in a fresh scratch cluster, on a 16-core machine. The load is CPU-bound busy loops running beside it, plus whatever other agents were running.
origin/mainjust db testwith the query-cache checkWhat's left
invitation_revocation_waits_for_signup,revoked_invitations_cannot_be_redeemedandmutations_recheck_the_confirmation_after_waitingpassed in every run here, and they're unchanged.just validatepasses exceptjust audit. It fails on RUSTSEC-2026-0592 inurl2.5.8, which is also onmain, and #707 fixes it.just docspasses.Refs #708
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)