Skip to content

Commit

Permalink
show logging on failed cli tests & adjust candidate_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ramfox committed Jun 27, 2023
1 parent 2c41eed commit 80aafb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
9 changes: 1 addition & 8 deletions iroh-net/src/hp/magicsock/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl Endpoint {
None
};

debug!("using candidate addr {addr:?}, derp addr: {derp_addr:?}");
(addr, derp_addr, should_ping)
}
}
Expand Down Expand Up @@ -192,14 +193,6 @@ impl Endpoint {
.keys()
.choose_stable(&mut rand::thread_rng())
.copied();
if let Some(addr) = udp_addr {
self.best_addr = Some(AddrLatency {
addr,
latency: None,
});

self.trust_best_addr_until = Some(*now + Duration::from_secs(15));
}

(udp_addr, udp_addr.is_some())
}
Expand Down
12 changes: 7 additions & 5 deletions iroh/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn make_partial_download(out_dir: &Path) -> anyhow::Result<Hash> {
}

#[test]
fn cli_provide_one_file() -> Result<()> {
fn cli_provide_one_file_basic() -> Result<()> {
let dir = testdir!();
let path = dir.join("foo");
make_rand_file(1000, &path)?;
Expand Down Expand Up @@ -376,8 +376,12 @@ fn test_provide_get_loop(path: &Path, input: Input, output: Output) -> Result<()
.stderr_capture();

// test get stderr output
let get_output = cmd.run()?;
let get_output = cmd.unchecked().run()?;
drop(provider);

// checking the output first, so you can still view any logging
assert!(!get_output.stderr.is_empty());
match_get_stderr(get_output.stderr)?;
assert!(get_output.status.success());

// test output
Expand All @@ -389,9 +393,7 @@ fn test_provide_get_loop(path: &Path, input: Input, output: Output) -> Result<()
}
Some(out) => compare_files(path, out)?,
};

assert!(!get_output.stderr.is_empty());
match_get_stderr(get_output.stderr)
Ok(())
}

/// Test the provide and get loop for success, stderr output, and file contents.
Expand Down

0 comments on commit 80aafb1

Please sign in to comment.