Tolerate failure to join remote projects in randomized test

This commit is contained in:
Max Brunsfeld 2023-01-06 15:40:42 -08:00
parent 99390a7237
commit 2351f2bd0c

View file

@ -7,7 +7,7 @@ use anyhow::{anyhow, Result};
use call::ActiveCall; use call::ActiveCall;
use client::RECEIVE_TIMEOUT; use client::RECEIVE_TIMEOUT;
use collections::{BTreeMap, HashSet}; use collections::{BTreeMap, HashSet};
use fs::Fs as _; use fs::{FakeFs, Fs as _};
use futures::StreamExt as _; use futures::StreamExt as _;
use gpui::{executor::Deterministic, ModelHandle, TestAppContext}; use gpui::{executor::Deterministic, ModelHandle, TestAppContext};
use language::{range_to_lsp, FakeLspAdapter, Language, LanguageConfig, PointUtf16}; use language::{range_to_lsp, FakeLspAdapter, Language, LanguageConfig, PointUtf16};
@ -531,22 +531,30 @@ async fn apply_client_operation(
); );
let active_call = cx.read(ActiveCall::global); let active_call = cx.read(ActiveCall::global);
let project_id = active_call let project = active_call
.read_with(cx, |call, cx| { .update(cx, |call, cx| {
let room = call.room().cloned()?; let room = call.room().cloned()?;
let participant = room let participant = room
.read(cx) .read(cx)
.remote_participants() .remote_participants()
.get(&host_id.to_proto())?; .get(&host_id.to_proto())?;
let project = participant let project_id = participant
.projects .projects
.iter() .iter()
.find(|project| project.worktree_root_names[0] == first_root_name)?; .find(|project| project.worktree_root_names[0] == first_root_name)?
Some(project.id) .id;
Some(room.update(cx, |room, cx| {
room.join_project(
project_id,
client.language_registry.clone(),
FakeFs::new(cx.background().clone()),
cx,
)
}))
}) })
.expect("invalid project in test operation"); .expect("invalid project in test operation")
let project = client.build_remote_project(project_id, cx).await; .await?;
client.remote_projects_mut().push(project); client.remote_projects_mut().push(project.clone());
} }
ClientOperation::CreateWorktreeEntry { ClientOperation::CreateWorktreeEntry {