From 9a806ca89ce78be00170553104d1cfd74fefae85 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Mon, 15 Apr 2024 14:55:23 +0100 Subject: [PATCH] Fix flaky test_cleanup_intermediate_files --- object_store/src/local.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/object_store/src/local.rs b/object_store/src/local.rs index 0d7c279b3190..d5581cdc8f59 100644 --- a/object_store/src/local.rs +++ b/object_store/src/local.rs @@ -1450,10 +1450,14 @@ mod not_wasm_tests { assert_eq!(file_count, 1); drop(upload); - tokio::time::sleep(Duration::from_millis(1)).await; - - let file_count = std::fs::read_dir(root.path()).unwrap().count(); - assert_eq!(file_count, 0); + for _ in 0..100 { + tokio::time::sleep(Duration::from_millis(1)).await; + let file_count = std::fs::read_dir(root.path()).unwrap().count(); + if file_count == 0 { + return; + } + } + panic!("Failed to cleanup file in 100ms") } }