Skip to content

Commit

Permalink
chore: output curl version in server test failure.
Browse files Browse the repository at this point in the history
In the event the `server()` integration test fails it's helpful to know
the version of `curl` that was used. This commit includes this
information when the `curl` client invocation returns a non-zero status
code.
  • Loading branch information
cpu committed Mar 7, 2023
1 parent fd8a111 commit e943c46
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ fn wait_for_server(addr: &str) {
panic!("failed to connect to {:?} after 10 tries", addr);
}

fn curl_version() -> String {
String::from_utf8_lossy(
&Command::new("curl")
.arg("--version")
.output()
.expect("cannot run curl to collect --version")
.stdout,
)
.to_string()
}

#[test]
fn client() {
let rc = client_command()
Expand Down Expand Up @@ -62,6 +73,7 @@ fn server() {
srv.kill().unwrap();

if !output.status.success() {
println!("curl version: {}", curl_version());
println!("curl stderr:\n{}", String::from_utf8_lossy(&output.stderr));
}

Expand Down

0 comments on commit e943c46

Please sign in to comment.