Fix integration test verifying the rename behavior

Specifically, the test now ensures that the host's worktree observes a/file1's
change event *before* the rename occurs, otherwise when interpreting the change
event it will mistakenly think that the file has been deleted (because its path
has changed) and will subsequently fail to detect the rename, causing the test
to fail.
This commit is contained in:
Antonio Scandurra 2022-02-12 12:26:39 +01:00
parent 7b9ff42679
commit f2b4a0665f
2 changed files with 19 additions and 6 deletions

View file

@ -1238,7 +1238,7 @@ mod tests {
LanguageConfig, LanguageRegistry, LanguageServerConfig, Point,
},
lsp,
project::{DiagnosticSummary, Project, ProjectPath},
project::{worktree::WorktreeHandle, DiagnosticSummary, Project, ProjectPath},
};
#[cfg(test)]
@ -1608,6 +1608,11 @@ mod tests {
buffer_b.read_with(&cx_b, |buf, _| assert!(!buf.is_dirty()));
buffer_c.condition(&cx_c, |buf, _| !buf.is_dirty()).await;
// Ensure worktree observes a/file1's change event *before* the rename occurs, otherwise
// when interpreting the change event it will mistakenly think that the file has been
// deleted (because its path has changed) and will subsequently fail to detect the rename.
worktree_a.flush_fs_events(&cx_a).await;
// Make changes on host's file system, see those changes on guest worktrees.
fs.rename(
"/a/file1".as_ref(),