Skip to content

Commit 1652829

Browse files
committed
update test
1 parent e221d48 commit 1652829

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

iroh/src/endpoint.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ mod tests {
13001300
use quinn::ConnectionError;
13011301
use rand::SeedableRng;
13021302
use tokio::sync::oneshot;
1303-
use tracing::{Instrument, error_span, info, info_span, instrument};
1303+
use tracing::{Instrument, debug, error_span, info, info_span, instrument};
13041304
use tracing_test::traced_test;
13051305

13061306
use super::Endpoint;
@@ -2488,15 +2488,15 @@ mod tests {
24882488
info!(id = %server.id().fmt_short(), "server online");
24892489
let server_addr = server.addr();
24902490

2491-
// We abort this example after two connections have finished.
2492-
let count = 2;
2491+
// We abort this example after 3 connections have finished.
2492+
let count = 3;
24932493

24942494
// Our server accepts connections, opens an uni stream, writes some data,
24952495
// and waits for the connection to be closed.
24962496
let server_task = tokio::spawn(
24972497
async move {
2498-
for _i in 0..count {
2499-
info!("wait for connection");
2498+
for i in 0..count {
2499+
info!("wait for connection {i}");
25002500
let conn = server
25012501
.accept()
25022502
.await
@@ -2506,20 +2506,20 @@ mod tests {
25062506
let mut s = conn.open_uni().await.anyerr()?;
25072507
s.write_all(b"hi").await.anyerr()?;
25082508
s.finish().anyerr()?;
2509-
info!("written");
2509+
debug!("written");
25102510
conn.closed().await;
2511-
info!("closed");
2511+
info!("connection {i} complete");
25122512
}
25132513
server.close().await;
25142514
n0_error::Ok(())
25152515
}
25162516
.instrument(info_span!("server")),
25172517
);
25182518

2519-
// Our client tasks creates a new endpoint and connects to the server two times.
2519+
// Our client tasks creates a new endpoint and connects to the server n times.
25202520
let client_task = tokio::spawn(
25212521
async move {
2522-
for _i in 0..count {
2522+
for i in 0..count {
25232523
let client = Endpoint::builder()
25242524
.relay_mode(relay_mode.clone())
25252525
.insecure_skip_relay_cert_verify(true)
@@ -2534,12 +2534,13 @@ mod tests {
25342534
info!("connected");
25352535
let mut s = conn.accept_uni().await.anyerr()?;
25362536
let data = s.read_to_end(2).await.anyerr()?;
2537-
info!("read");
2537+
debug!("read");
25382538
ensure_any!(data == b"hi", "unexpected data");
25392539
conn.close(23u32.into(), b"bye");
2540-
info!("conn closed");
2540+
debug!("conn closed");
25412541
client.close().await;
2542-
info!("endpoint closed");
2542+
debug!("endpoint closed");
2543+
info!("client round {i} complete");
25432544
}
25442545
n0_error::Ok(())
25452546
}

0 commit comments

Comments
 (0)