In randomized test, open remote projects via the room
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
8cd94060bb
commit
89da738fae
1 changed files with 20 additions and 11 deletions
|
@ -13,7 +13,7 @@ use gpui::{executor::Deterministic, TestAppContext};
|
||||||
use language::{range_to_lsp, FakeLspAdapter, Language, LanguageConfig, PointUtf16};
|
use language::{range_to_lsp, FakeLspAdapter, Language, LanguageConfig, PointUtf16};
|
||||||
use lsp::FakeLanguageServer;
|
use lsp::FakeLanguageServer;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use project::{search::SearchQuery, Project};
|
use project::search::SearchQuery;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use std::{env, path::PathBuf, sync::Arc};
|
use std::{env, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
|
@ -139,7 +139,13 @@ async fn test_random_collaboration(
|
||||||
server.allow_connections();
|
server.allow_connections();
|
||||||
|
|
||||||
for project in &client.remote_projects {
|
for project in &client.remote_projects {
|
||||||
project.read_with(&client_cx, |project, _| assert!(project.is_read_only()));
|
project.read_with(&client_cx, |project, _| {
|
||||||
|
assert!(
|
||||||
|
project.is_read_only(),
|
||||||
|
"project {:?} should be read only",
|
||||||
|
project.remote_id()
|
||||||
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
for user_id in &user_ids {
|
for user_id in &user_ids {
|
||||||
let contacts = server.app_state.db.get_contacts(*user_id).await.unwrap();
|
let contacts = server.app_state.db.get_contacts(*user_id).await.unwrap();
|
||||||
|
@ -602,15 +608,18 @@ async fn randomly_mutate_client(
|
||||||
client.username,
|
client.username,
|
||||||
remote_project_id
|
remote_project_id
|
||||||
);
|
);
|
||||||
let remote_project = Project::remote(
|
let call = cx.read(ActiveCall::global);
|
||||||
remote_project_id,
|
let room = call.read_with(cx, |call, _| call.room().unwrap().clone());
|
||||||
client.client.clone(),
|
let remote_project = room
|
||||||
client.user_store.clone(),
|
.update(cx, |room, cx| {
|
||||||
client.language_registry.clone(),
|
room.join_project(
|
||||||
FakeFs::new(cx.background()),
|
remote_project_id,
|
||||||
cx.to_async(),
|
client.language_registry.clone(),
|
||||||
)
|
FakeFs::new(cx.background().clone()),
|
||||||
.await?;
|
cx,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
client.remote_projects.push(remote_project.clone());
|
client.remote_projects.push(remote_project.clone());
|
||||||
remote_project
|
remote_project
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue