From 1df0bc4f0066cdfa3ce350cfbd103dc5da2aa819 Mon Sep 17 00:00:00 2001 From: OpenFUT Agent Date: Thu, 13 Aug 2026 19:57:53 +0000 Subject: [PATCH] test(fifa17): make economy integration harness deterministic Serialize Core access with a single pooled connection (the harness drives Core sequentially via the blocking client) to avoid a WAL-mode-establishment race across connections warming up on a brand-new DB file, and raise the readiness ceiling for heavy parallel test-binary load. 10/10 deterministic. (Fixed alongside a real Core robustness fix: per-connection pragmas + busy_timeout, core 0360135.) --- openfut-utas-host/tests/economy_integration.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openfut-utas-host/tests/economy_integration.rs b/openfut-utas-host/tests/economy_integration.rs index 61fc945..b4ef59c 100644 --- a/openfut-utas-host/tests/economy_integration.rs +++ b/openfut-utas-host/tests/economy_integration.rs @@ -21,7 +21,12 @@ use serde_json::{json, Value}; /// Boot a Core instance against `db_url`, serving on an ephemeral port. Returns /// the serve task handle and its base URL. async fn start_core(db_url: &str) -> (tokio::task::JoinHandle<()>, String) { - let pool = openfut_core::db::init_pool(db_url, 5) + // One pooled connection: the harness drives Core sequentially (blocking + // client), so a single connection serializes access deterministically and + // avoids a WAL-mode-establishment race across connections warming up on a + // brand-new DB file. (Steady-state multi-connection concurrency is a + // separate, deferred requirement.) + let pool = openfut_core::db::init_pool(db_url, 1) .await .expect("core pool"); openfut_core::db::run_migrations(&pool) @@ -43,7 +48,10 @@ async fn start_core(db_url: &str) -> (tokio::task::JoinHandle<()>, String) { fn wait_ready(base: &str) { let http = reqwest::blocking::Client::new(); - for _ in 0..100 { + // Generous ceiling (~30s): returns on first success, so it only ever waits + // this long if Core genuinely never comes up. Under heavy parallel test-binary + // load Core's content load (CardDb::load) can take several seconds to be ready. + for _ in 0..1500 { if let Ok(r) = http.get(format!("{base}/health")).send() { if r.status().is_success() { return;