From be1562e08931b1c9a6308f3021aeae8b18dda056 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Tue, 25 Aug 2026 21:21:52 +0800 Subject: [PATCH] test(heal): wait for versioned fixture copies (#6571) --- .../tests/heal_b5_versioned_regression_test.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/heal/tests/heal_b5_versioned_regression_test.rs b/crates/heal/tests/heal_b5_versioned_regression_test.rs index 95e0f0a90..05d789d4f 100644 --- a/crates/heal/tests/heal_b5_versioned_regression_test.rs +++ b/crates/heal/tests/heal_b5_versioned_regression_test.rs @@ -160,6 +160,22 @@ fn xl_meta_path(obj_dir: &Path) -> PathBuf { obj_dir.join("xl.meta") } +async fn wait_for_two_version_copies(disks: &[PathBuf], bucket: &str, object: &str) { + tokio::time::timeout(Duration::from_secs(5), async { + loop { + if disks.iter().all(|disk| { + let object_dir = object_dir(disk, bucket, object); + xl_meta_path(&object_dir).exists() && count_part_files(&object_dir) >= 2 + }) { + break; + } + tokio::time::sleep(Duration::from_millis(10)).await; + } + }) + .await + .expect("PUT rename tails must converge before wiping the versioned fixture"); +} + fn recreate_heal_opts() -> HealOpts { // Mirrors the proven-working object heal opts in // `heal_integration_test::test_heal_format_with_data`. @@ -289,6 +305,7 @@ mod serial_tests { let data_v2 = versioned_test_data(20); let v1 = put_versioned(&ecstore, bucket, object, &data_v1).await; // OLD, non-latest let v2 = put_versioned(&ecstore, bucket, object, &data_v2).await; // latest + wait_for_two_version_copies(&disk_paths, bucket, object).await; // ── Pre-wipe: prove the fixture actually has 2 versions on disk[0] ── let obj_dir0 = object_dir(&disk_paths[0], bucket, object);