From d42bc52f8bc74ceb611b6bfa809756dc32a3e90b Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Wed, 29 Jul 2026 17:29:18 +0800 Subject: [PATCH] test(heal): avoid live disk removal race (#5421) --- crates/heal/tests/heal_integration_test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/heal/tests/heal_integration_test.rs b/crates/heal/tests/heal_integration_test.rs index 55fe05570..35bf55fc5 100644 --- a/crates/heal/tests/heal_integration_test.rs +++ b/crates/heal/tests/heal_integration_test.rs @@ -390,8 +390,10 @@ mod serial_tests { // ─── 1️⃣ delete format.json on one disk ────────────── let format_path = disk_paths[0].join(".rustfs.sys").join("format.json"); - std::fs::remove_dir_all(&disk_paths[0]).expect("failed to delete all contents under disk_paths[0]"); + let failed_disk_path = disk_paths[0].with_extension("failed"); + std::fs::rename(&disk_paths[0], &failed_disk_path).expect("failed to detach disk_paths[0]"); std::fs::create_dir_all(&disk_paths[0]).expect("failed to recreate disk_paths[0] directory"); + assert!(!format_path.exists(), "replacement disk already contains format.json before heal"); println!("✅ Deleted format.json on disk: {:?}", disk_paths[0]); let (_format_result, format_error) = heal_storage.heal_format(false).await.expect("failed to run heal_format");