From 48ad3866b7ea01b0eb8662192d8d3ffefbb80ab1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 May 2023 17:01:11 +0200 Subject: [PATCH] Randomly mutate worktree in addition to mutating the file-system This ensures that we test the code path that refreshes entries. Co-Authored-By: Julia Risley --- crates/project/src/worktree.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index cc326690ec..bdbfff9a06 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -3946,7 +3946,17 @@ mod tests { let mut mutations_len = operations; fs.as_fake().pause_events().await; while mutations_len > 1 { - randomly_mutate_fs(&fs, root_dir, 1.0, &mut rng).await; + if rng.gen_bool(0.2) { + worktree + .update(cx, |worktree, cx| { + randomly_mutate_worktree(worktree, &mut rng, cx) + }) + .await + .unwrap(); + } else { + randomly_mutate_fs(&fs, root_dir, 1.0, &mut rng).await; + } + let buffered_event_count = fs.as_fake().buffered_event_count().await; if buffered_event_count > 0 && rng.gen_bool(0.3) { let len = rng.gen_range(0..=buffered_event_count);