Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Mar 15, 2024
1 parent f4869f5 commit 47321fd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions iroh-bytes/src/downloader/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,15 @@ async fn concurrent_progress() {

state_a.on_progress(prog1_a);
state_b.on_progress(prog1_b);
assert_eq!(state_a, state_b);

let (prog_c_tx, prog_c_rx) = flume::bounded(64);
let handle_c = downloader.queue(kind_1, vec![peer], Some(prog_c_tx)).await;

let prog1_c = prog_c_rx.recv_async().await.unwrap();
assert!(matches!(&prog1_c, DownloadProgress::InitialState(state) if state == &state_a));
state_c.on_progress(prog1_c);

done_tx.send(()).unwrap();

let (res_a, res_b, res_c) = futures::future::join3(handle_a, handle_b, handle_c).await;
Expand All @@ -281,14 +286,11 @@ async fn concurrent_progress() {

assert_eq!(prog_a.len(), 1);
assert_eq!(prog_b.len(), 1);
assert_eq!(prog_c.len(), 2);
assert_eq!(prog_c.len(), 1);

assert!(matches!(prog_a[0], DownloadProgress::Done { .. }));
assert!(matches!(prog_b[0], DownloadProgress::Done { .. }));

assert!(matches!(prog_c[0], DownloadProgress::InitialState(..)));
assert!(matches!(prog_c[1], DownloadProgress::Done { .. }));
assert!(matches!(&prog_c[0], DownloadProgress::InitialState(state) if state == &state_a));
assert!(matches!(prog_c[0], DownloadProgress::Done { .. }));

for p in prog_a {
state_a.on_progress(p);
Expand Down

0 comments on commit 47321fd

Please sign in to comment.