Skip to content

Commit dc1b656

Browse files
PiquelChipsclaude
andcommitted
fix(auth): give timing-sensitive database tests room under parallel load
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e6239f5 commit dc1b656

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎apps/auth-service/src/security/tests.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ async fn router_enforces_exact_browser_origins_csrf_and_public_client_cors_bound
276276
#[tokio::test]
277277
#[ignore = "requires TEST_DATABASE_URL"]
278278
async fn optional_session_preserves_database_failure_instead_of_reporting_signed_out() {
279-
let database = SecurityFixture::database(1, std::time::Duration::from_millis(50)).await;
279+
// The timeout also bounds the first connection, so it leaves room for
280+
// connecting while other database tests run.
281+
let database = SecurityFixture::database(1, std::time::Duration::from_secs(1)).await;
280282
// Exhaust only this test's private pool; the database and all other tests
281283
// remain usable. A well-formed session cookie must trigger a real lookup.
282284
let transaction = database.begin().await.expect("hold sole connection");
@@ -347,15 +349,17 @@ async fn rate_limit_deadline_includes_a_blocked_database_query() {
347349
.allow_request(bucket.as_bytes(), 120)
348350
.await
349351
.expect("hold bucket lock");
350-
fixture.policy.request_timeout = std::time::Duration::from_millis(100);
352+
// The deadline also bounds the request after the lock is released, so it
353+
// leaves room for queries while other database tests run.
354+
fixture.policy.request_timeout = std::time::Duration::from_secs(1);
351355
fixture.router = Router::new()
352356
.route("/oauth/token", any(|| async { StatusCode::ACCEPTED }))
353357
.layer(middleware::from_fn_with_state(
354358
fixture.policy.clone(),
355359
HttpSecurity::protect,
356360
));
357361
let response = tokio::time::timeout(
358-
std::time::Duration::from_secs(2),
362+
std::time::Duration::from_secs(5),
359363
fixture.request(Method::POST, "/oauth/token", None, false),
360364
)
361365
.await

0 commit comments

Comments
 (0)