From 012430759f319f24d84593bee1769f6f6051abed Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:17:58 +0100 Subject: [PATCH] Fix flaky test_cleanup_intermediate_files (#5645) --- 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") } }