mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-11 21:00:35 +00:00
Uncomment randomized tests for contacts
This commit is contained in:
parent
47ce8ae05c
commit
c2973f33c2
1 changed files with 45 additions and 27 deletions
|
@ -5928,16 +5928,23 @@ mod tests {
|
||||||
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);
|
||||||
}
|
}
|
||||||
// TODO
|
|
||||||
// let contacts = server
|
let contacts = server
|
||||||
// .store
|
.app_state
|
||||||
// .read()
|
.db
|
||||||
// .await
|
.get_contacts(guest.current_user_id(&guest_cx))
|
||||||
// .contacts_for_user(guest.current_user_id(&guest_cx));
|
.await
|
||||||
// assert!(!contacts
|
.unwrap();
|
||||||
// .iter()
|
let contacts = server
|
||||||
// .flat_map(|contact| &contact.projects)
|
.store
|
||||||
// .any(|project| project.id == host_project_id));
|
.read()
|
||||||
|
.await
|
||||||
|
.build_initial_contacts_update(contacts)
|
||||||
|
.contacts;
|
||||||
|
assert!(!contacts
|
||||||
|
.iter()
|
||||||
|
.flat_map(|contact| &contact.projects)
|
||||||
|
.any(|project| project.id == host_project_id));
|
||||||
guest
|
guest
|
||||||
.project
|
.project
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -5997,9 +6004,12 @@ mod tests {
|
||||||
let removed_guest_id = user_ids.remove(guest_ix);
|
let removed_guest_id = user_ids.remove(guest_ix);
|
||||||
let guest = clients.remove(guest_ix);
|
let guest = clients.remove(guest_ix);
|
||||||
op_start_signals.remove(guest_ix);
|
op_start_signals.remove(guest_ix);
|
||||||
|
server.forbid_connections();
|
||||||
server.disconnect_client(removed_guest_id);
|
server.disconnect_client(removed_guest_id);
|
||||||
cx.foreground().advance_clock(RECEIVE_TIMEOUT);
|
cx.foreground().advance_clock(RECEIVE_TIMEOUT);
|
||||||
let (guest, mut guest_cx, guest_err) = guest.await;
|
let (guest, mut guest_cx, guest_err) = guest.await;
|
||||||
|
server.allow_connections();
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -6008,23 +6018,31 @@ mod tests {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.read_with(&guest_cx, |project, _| assert!(project.is_read_only()));
|
.read_with(&guest_cx, |project, _| assert!(project.is_read_only()));
|
||||||
// TODO
|
for user_id in &user_ids {
|
||||||
// for user_id in &user_ids {
|
let contacts = server.app_state.db.get_contacts(*user_id).await.unwrap();
|
||||||
// for contact in server.store.read().await.contacts_for_user(*user_id) {
|
let contacts = server
|
||||||
// assert_ne!(
|
.store
|
||||||
// contact.user_id, removed_guest_id.0 as u64,
|
.read()
|
||||||
// "removed guest is still a contact of another peer"
|
.await
|
||||||
// );
|
.build_initial_contacts_update(contacts)
|
||||||
// for project in contact.projects {
|
.contacts;
|
||||||
// for project_guest_id in project.guests {
|
for contact in contacts {
|
||||||
// assert_ne!(
|
if contact.online {
|
||||||
// project_guest_id, removed_guest_id.0 as u64,
|
assert_ne!(
|
||||||
// "removed guest appears as still participating on a project"
|
contact.user_id, removed_guest_id.0 as u64,
|
||||||
// );
|
"removed guest is still a contact of another peer"
|
||||||
// }
|
);
|
||||||
// }
|
}
|
||||||
// }
|
for project in contact.projects {
|
||||||
// }
|
for project_guest_id in project.guests {
|
||||||
|
assert_ne!(
|
||||||
|
project_guest_id, removed_guest_id.0 as u64,
|
||||||
|
"removed guest appears as still participating on a project"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log::info!("{} removed", guest.username);
|
log::info!("{} removed", guest.username);
|
||||||
available_guests.push(guest.username.clone());
|
available_guests.push(guest.username.clone());
|
||||||
|
|
Loading…
Reference in a new issue