Skip to content

Commit bbebf3b

Browse files
committed
update test
1 parent aa532dc commit bbebf3b

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
@@ -1331,7 +1331,7 @@ mod tests {
13311331
use quinn::ConnectionError;
13321332
use rand::SeedableRng;
13331333
use tokio::sync::oneshot;
1334-
use tracing::{Instrument, error_span, info, info_span, instrument};
1334+
use tracing::{Instrument, debug, error_span, info, info_span, instrument};
13351335
use tracing_test::traced_test;
13361336

13371337
use super::Endpoint;
@@ -2519,15 +2519,15 @@ mod tests {
25192519
info!(id = %server.id().fmt_short(), "server online");
25202520
let server_addr = server.addr();
25212521

2522-
// We abort this example after two connections have finished.
2523-
let count = 2;
2522+
// We abort this example after 3 connections have finished.
2523+
let count = 3;
25242524

25252525
// Our server accepts connections, opens an uni stream, writes some data,
25262526
// and waits for the connection to be closed.
25272527
let server_task = tokio::spawn(
25282528
async move {
2529-
for _i in 0..count {
2530-
info!("wait for connection");
2529+
for i in 0..count {
2530+
info!("wait for connection {i}");
25312531
let conn = server
25322532
.accept()
25332533
.await
@@ -2537,20 +2537,20 @@ mod tests {
25372537
let mut s = conn.open_uni().await.anyerr()?;
25382538
s.write_all(b"hi").await.anyerr()?;
25392539
s.finish().anyerr()?;
2540-
info!("written");
2540+
debug!("written");
25412541
conn.closed().await;
2542-
info!("closed");
2542+
info!("connection {i} complete");
25432543
}
25442544
server.close().await;
25452545
n0_error::Ok(())
25462546
}
25472547
.instrument(info_span!("server")),
25482548
);
25492549

2550-
// Our client tasks creates a new endpoint and connects to the server two times.
2550+
// Our client tasks creates a new endpoint and connects to the server n times.
25512551
let client_task = tokio::spawn(
25522552
async move {
2553-
for _i in 0..count {
2553+
for i in 0..count {
25542554
let client = Endpoint::builder()
25552555
.relay_mode(relay_mode.clone())
25562556
.insecure_skip_relay_cert_verify(true)
@@ -2565,12 +2565,13 @@ mod tests {
25652565
info!("connected");
25662566
let mut s = conn.accept_uni().await.anyerr()?;
25672567
let data = s.read_to_end(2).await.anyerr()?;
2568-
info!("read");
2568+
debug!("read");
25692569
ensure_any!(data == b"hi", "unexpected data");
25702570
conn.close(23u32.into(), b"bye");
2571-
info!("conn closed");
2571+
debug!("conn closed");
25722572
client.close().await;
2573-
info!("endpoint closed");
2573+
debug!("endpoint closed");
2574+
info!("client round {i} complete");
25742575
}
25752576
n0_error::Ok(())
25762577
}

0 commit comments

Comments
 (0)