diff --git a/core/archipelago/src/update.rs b/core/archipelago/src/update.rs index c08476e5..3e6e22f3 100644 --- a/core/archipelago/src/update.rs +++ b/core/archipelago/src/update.rs @@ -2565,8 +2565,14 @@ mod tests { assert!(!persisted.update_in_progress); } + /// apply_update takes the global single-flight UPDATE_OP_LOCK, so tests + /// that call it must not run concurrently — one would see the other's + /// lock and fail with "another update operation is already running". + static APPLY_TEST_SERIAL: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); + #[tokio::test] async fn test_apply_refuses_unmarked_staging() { + let _serial = APPLY_TEST_SERIAL.lock().await; // Regression: .198 v1.7.103 bricking — apply ran against a staging // dir that a concurrent download was still filling. Without the // .download-complete marker, apply must refuse before touching @@ -2586,6 +2592,7 @@ mod tests { #[tokio::test] async fn test_apply_refuses_staged_bytes_that_mismatch_manifest() { + let _serial = APPLY_TEST_SERIAL.lock().await; // Marker present (a complete download once existed) but the staged // bytes no longer match the manifest — apply must re-verify and // refuse rather than install whatever is on disk.