Open buffers from definitions request in random collab test

Don't try to open buffers from the weak worktrees directly, as this is
expected to fail if the host drops the buffer for that worktree.
This commit is contained in:
Max Brunsfeld 2022-02-23 18:22:51 -08:00
parent 51e2e9e68d
commit f1921c8df5

View File

@ -4880,7 +4880,8 @@ mod tests {
project
.worktrees(&cx)
.filter(|worktree| {
worktree.read(cx).entries(false).any(|e| e.is_file())
let worktree = worktree.read(cx);
!worktree.is_weak() && worktree.entries(false).any(|e| e.is_file())
})
.choose(&mut *rng.lock())
}) {
@ -5033,13 +5034,14 @@ mod tests {
project.definition(&buffer, offset, cx)
});
let definitions = cx.background().spawn(async move {
definitions.await.expect("definitions request failed");
definitions.await.expect("definitions request failed")
});
if rng.lock().gen_bool(0.3) {
log::info!("Guest {}: detaching definitions request", guest_id);
definitions.detach();
} else {
definitions.await;
self.buffers
.extend(definitions.await.into_iter().map(|loc| loc.buffer));
}
}
50..=55 => {