mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-03 00:21:32 +03:00
Fix randomized integration test failure
This commit is contained in:
parent
6426037653
commit
bec6b41448
@ -4675,20 +4675,20 @@ async fn test_random_collaboration(
|
|||||||
deterministic.finish_waiting();
|
deterministic.finish_waiting();
|
||||||
deterministic.run_until_parked();
|
deterministic.run_until_parked();
|
||||||
|
|
||||||
let (host, host_project, mut host_cx, host_err) = clients.remove(0);
|
let (host, host_room, host_project, mut host_cx, host_err) = clients.remove(0);
|
||||||
if let Some(host_err) = host_err {
|
if let Some(host_err) = host_err {
|
||||||
log::error!("host error - {:?}", host_err);
|
log::error!("host error - {:?}", host_err);
|
||||||
}
|
}
|
||||||
host_project.read_with(&host_cx, |project, _| assert!(!project.is_shared()));
|
host_project.read_with(&host_cx, |project, _| assert!(!project.is_shared()));
|
||||||
for (guest, guest_project, mut guest_cx, guest_err) in clients {
|
for (guest, guest_room, guest_project, mut guest_cx, guest_err) in clients {
|
||||||
if let Some(guest_err) = guest_err {
|
if let Some(guest_err) = guest_err {
|
||||||
log::error!("{} error - {:?}", guest.username, guest_err);
|
log::error!("{} error - {:?}", guest.username, guest_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
guest_project.read_with(&guest_cx, |project, _| assert!(project.is_read_only()));
|
guest_project.read_with(&guest_cx, |project, _| assert!(project.is_read_only()));
|
||||||
guest_cx.update(|_| drop((guest, guest_project)));
|
guest_cx.update(|_| drop((guest, guest_room, guest_project)));
|
||||||
}
|
}
|
||||||
host_cx.update(|_| drop((host, host_project)));
|
host_cx.update(|_| drop((host, host_room, host_project)));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4773,7 +4773,7 @@ async fn test_random_collaboration(
|
|||||||
deterministic.advance_clock(RECEIVE_TIMEOUT);
|
deterministic.advance_clock(RECEIVE_TIMEOUT);
|
||||||
deterministic.start_waiting();
|
deterministic.start_waiting();
|
||||||
log::info!("Waiting for guest {} to exit...", removed_guest_id);
|
log::info!("Waiting for guest {} to exit...", removed_guest_id);
|
||||||
let (guest, guest_project, mut guest_cx, guest_err) = guest.await;
|
let (guest, guest_room, guest_project, mut guest_cx, guest_err) = guest.await;
|
||||||
deterministic.finish_waiting();
|
deterministic.finish_waiting();
|
||||||
server.allow_connections();
|
server.allow_connections();
|
||||||
|
|
||||||
@ -4801,7 +4801,7 @@ async fn test_random_collaboration(
|
|||||||
|
|
||||||
log::info!("{} removed", guest.username);
|
log::info!("{} removed", guest.username);
|
||||||
available_guests.push(guest.username.clone());
|
available_guests.push(guest.username.clone());
|
||||||
guest_cx.update(|_| drop((guest, guest_project)));
|
guest_cx.update(|_| drop((guest, guest_room, guest_project)));
|
||||||
|
|
||||||
operations += 1;
|
operations += 1;
|
||||||
}
|
}
|
||||||
@ -4828,7 +4828,7 @@ async fn test_random_collaboration(
|
|||||||
deterministic.finish_waiting();
|
deterministic.finish_waiting();
|
||||||
deterministic.run_until_parked();
|
deterministic.run_until_parked();
|
||||||
|
|
||||||
let (host_client, host_project, mut host_cx, host_err) = clients.remove(0);
|
let (host_client, host_room, host_project, mut host_cx, host_err) = clients.remove(0);
|
||||||
if let Some(host_err) = host_err {
|
if let Some(host_err) = host_err {
|
||||||
panic!("host error - {:?}", host_err);
|
panic!("host error - {:?}", host_err);
|
||||||
}
|
}
|
||||||
@ -4844,7 +4844,7 @@ async fn test_random_collaboration(
|
|||||||
|
|
||||||
host_project.read_with(&host_cx, |project, cx| project.check_invariants(cx));
|
host_project.read_with(&host_cx, |project, cx| project.check_invariants(cx));
|
||||||
|
|
||||||
for (guest_client, guest_project, mut guest_cx, guest_err) in clients.into_iter() {
|
for (guest_client, guest_room, guest_project, mut guest_cx, guest_err) in clients.into_iter() {
|
||||||
if let Some(guest_err) = guest_err {
|
if let Some(guest_err) = guest_err {
|
||||||
panic!("{} error - {:?}", guest_client.username, guest_err);
|
panic!("{} error - {:?}", guest_client.username, guest_err);
|
||||||
}
|
}
|
||||||
@ -4916,10 +4916,10 @@ async fn test_random_collaboration(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
guest_cx.update(|_| drop((guest_project, guest_client)));
|
guest_cx.update(|_| drop((guest_room, guest_project, guest_client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
host_cx.update(|_| drop((host_client, host_project)));
|
host_cx.update(|_| drop((host_client, host_room, host_project)));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestServer {
|
struct TestServer {
|
||||||
@ -5315,13 +5315,14 @@ impl TestClient {
|
|||||||
|
|
||||||
async fn simulate_host(
|
async fn simulate_host(
|
||||||
mut self,
|
mut self,
|
||||||
_room: ModelHandle<Room>,
|
room: ModelHandle<Room>,
|
||||||
project: ModelHandle<Project>,
|
project: ModelHandle<Project>,
|
||||||
op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>,
|
op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>,
|
||||||
rng: Arc<Mutex<StdRng>>,
|
rng: Arc<Mutex<StdRng>>,
|
||||||
mut cx: TestAppContext,
|
mut cx: TestAppContext,
|
||||||
) -> (
|
) -> (
|
||||||
Self,
|
Self,
|
||||||
|
ModelHandle<Room>,
|
||||||
ModelHandle<Project>,
|
ModelHandle<Project>,
|
||||||
TestAppContext,
|
TestAppContext,
|
||||||
Option<anyhow::Error>,
|
Option<anyhow::Error>,
|
||||||
@ -5447,19 +5448,20 @@ impl TestClient {
|
|||||||
let result =
|
let result =
|
||||||
simulate_host_internal(&mut self, project.clone(), op_start_signal, rng, &mut cx).await;
|
simulate_host_internal(&mut self, project.clone(), op_start_signal, rng, &mut cx).await;
|
||||||
log::info!("Host done");
|
log::info!("Host done");
|
||||||
(self, project, cx, result.err())
|
(self, room, project, cx, result.err())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn simulate_guest(
|
pub async fn simulate_guest(
|
||||||
mut self,
|
mut self,
|
||||||
guest_username: String,
|
guest_username: String,
|
||||||
_room: ModelHandle<Room>,
|
room: ModelHandle<Room>,
|
||||||
project: ModelHandle<Project>,
|
project: ModelHandle<Project>,
|
||||||
op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>,
|
op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>,
|
||||||
rng: Arc<Mutex<StdRng>>,
|
rng: Arc<Mutex<StdRng>>,
|
||||||
mut cx: TestAppContext,
|
mut cx: TestAppContext,
|
||||||
) -> (
|
) -> (
|
||||||
Self,
|
Self,
|
||||||
|
ModelHandle<Room>,
|
||||||
ModelHandle<Project>,
|
ModelHandle<Project>,
|
||||||
TestAppContext,
|
TestAppContext,
|
||||||
Option<anyhow::Error>,
|
Option<anyhow::Error>,
|
||||||
@ -5778,7 +5780,7 @@ impl TestClient {
|
|||||||
.await;
|
.await;
|
||||||
log::info!("{}: done", guest_username);
|
log::info!("{}: done", guest_username);
|
||||||
|
|
||||||
(self, project, cx, result.err())
|
(self, room, project, cx, result.err())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user