mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
test: fix flaky test_webxdc_resend
This commit is contained in:
@@ -990,10 +990,19 @@ mod tests {
|
|||||||
alice.recv_msg_trash(&fiona_advert).await;
|
alice.recv_msg_trash(&fiona_advert).await;
|
||||||
|
|
||||||
fiona_connect_future.await.unwrap();
|
fiona_connect_future.await.unwrap();
|
||||||
|
|
||||||
|
let realtime_send_loop = async {
|
||||||
|
// Keep sending in a loop because right after joining
|
||||||
|
// Fiona may miss messages.
|
||||||
|
loop {
|
||||||
send_webxdc_realtime_data(alice, instance.id, b"alice -> bob & fiona".into())
|
send_webxdc_realtime_data(alice, instance.id, b"alice -> bob & fiona".into())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let realtime_receive_loop = async {
|
||||||
loop {
|
loop {
|
||||||
let event = fiona.evtracker.recv().await.unwrap();
|
let event = fiona.evtracker.recv().await.unwrap();
|
||||||
if let EventType::WebxdcRealtimeData { data, .. } = event.typ {
|
if let EventType::WebxdcRealtimeData { data, .. } = event.typ {
|
||||||
@@ -1007,6 +1016,15 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
tokio::select!(
|
||||||
|
_ = realtime_send_loop => {
|
||||||
|
panic!("Send loop should never finish");
|
||||||
|
},
|
||||||
|
_ = realtime_receive_loop => {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn connect_alice_bob(
|
async fn connect_alice_bob(
|
||||||
|
|||||||
Reference in New Issue
Block a user