From bcf9b2f10dfec38fbff289327725da014c5a4d11 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 3 Apr 2023 22:42:34 -0700 Subject: [PATCH] Add missing random delays in FakeFs --- crates/fs/src/fs.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index 4d0b0c4f447d541eb3fbaecd67d2ea49dc9ad42b..c53c20c774bfd087dc914ecfeb9e596754298e54 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -801,6 +801,8 @@ impl Fs for FakeFs { } async fn rename(&self, old_path: &Path, new_path: &Path, options: RenameOptions) -> Result<()> { + self.simulate_random_delay().await; + let old_path = normalize_path(old_path); let new_path = normalize_path(new_path); let mut state = self.state.lock(); @@ -831,6 +833,8 @@ impl Fs for FakeFs { } async fn copy_file(&self, source: &Path, target: &Path, options: CopyOptions) -> Result<()> { + self.simulate_random_delay().await; + let source = normalize_path(source); let target = normalize_path(target); let mut state = self.state.lock(); @@ -866,6 +870,8 @@ impl Fs for FakeFs { } async fn remove_dir(&self, path: &Path, options: RemoveOptions) -> Result<()> { + self.simulate_random_delay().await; + let path = normalize_path(path); let parent_path = path .parent() @@ -901,6 +907,8 @@ impl Fs for FakeFs { } async fn remove_file(&self, path: &Path, options: RemoveOptions) -> Result<()> { + self.simulate_random_delay().await; + let path = normalize_path(path); let parent_path = path .parent()