Insert random delays when sending and receiving websocket messages in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
d241ab6370
commit
2b8685c1a2
6 changed files with 53 additions and 21 deletions
|
@ -353,12 +353,14 @@ mod tests {
|
|||
let client1 = Peer::new();
|
||||
let client2 = Peer::new();
|
||||
|
||||
let (client1_to_server_conn, server_to_client_1_conn, _) = Connection::in_memory();
|
||||
let (client1_to_server_conn, server_to_client_1_conn, _) =
|
||||
Connection::in_memory(cx.background());
|
||||
let (client1_conn_id, io_task1, client1_incoming) =
|
||||
client1.add_connection(client1_to_server_conn).await;
|
||||
let (_, io_task2, server_incoming1) = server.add_connection(server_to_client_1_conn).await;
|
||||
|
||||
let (client2_to_server_conn, server_to_client_2_conn, _) = Connection::in_memory();
|
||||
let (client2_to_server_conn, server_to_client_2_conn, _) =
|
||||
Connection::in_memory(cx.background());
|
||||
let (client2_conn_id, io_task3, client2_incoming) =
|
||||
client2.add_connection(client2_to_server_conn).await;
|
||||
let (_, io_task4, server_incoming2) = server.add_connection(server_to_client_2_conn).await;
|
||||
|
@ -489,7 +491,8 @@ mod tests {
|
|||
let server = Peer::new();
|
||||
let client = Peer::new();
|
||||
|
||||
let (client_to_server_conn, server_to_client_conn, _) = Connection::in_memory();
|
||||
let (client_to_server_conn, server_to_client_conn, _) =
|
||||
Connection::in_memory(cx.background());
|
||||
let (client_to_server_conn_id, io_task1, mut client_incoming) =
|
||||
client.add_connection(client_to_server_conn).await;
|
||||
let (server_to_client_conn_id, io_task2, mut server_incoming) =
|
||||
|
@ -589,7 +592,7 @@ mod tests {
|
|||
async fn test_disconnect(cx: TestAppContext) {
|
||||
let executor = cx.foreground();
|
||||
|
||||
let (client_conn, mut server_conn, _) = Connection::in_memory();
|
||||
let (client_conn, mut server_conn, _) = Connection::in_memory(cx.background());
|
||||
|
||||
let client = Peer::new();
|
||||
let (connection_id, io_handler, mut incoming) = client.add_connection(client_conn).await;
|
||||
|
@ -623,7 +626,7 @@ mod tests {
|
|||
#[gpui::test(iterations = 10)]
|
||||
async fn test_io_error(cx: TestAppContext) {
|
||||
let executor = cx.foreground();
|
||||
let (client_conn, mut server_conn, _) = Connection::in_memory();
|
||||
let (client_conn, mut server_conn, _) = Connection::in_memory(cx.background());
|
||||
|
||||
let client = Peer::new();
|
||||
let (connection_id, io_handler, mut incoming) = client.add_connection(client_conn).await;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue