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.)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user