From 1decdd2b05ad0699aa43605a0af17ef7375dd167 Mon Sep 17 00:00:00 2001 From: Lann Martin Date: Tue, 7 Mar 2023 13:54:20 -0500 Subject: [PATCH] tests: Improve integration test output on assertion failure The child process output was only being printed on process failure, not later test assertions. Printing the output unconditionally allows it to be seen on any failure without noisy --nocapture. Signed-off-by: Lann Martin --- tests/integration.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index 4ae5daac1..d9d13ee35 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -845,6 +845,8 @@ mod integration_tests { .collect::>() .join(" "), ); + + cmd.env("RUST_LOG", "spin_cli=warn"); if let Some(envs) = envs { for (k, v) in envs { cmd.env(k, v); @@ -852,10 +854,11 @@ mod integration_tests { } let output = cmd.output()?; + println!("STDOUT:\n{}", String::from_utf8_lossy(&output.stdout)); + println!("STDERR:\n{}", String::from_utf8_lossy(&output.stderr)); + let code = output.status.code().expect("should have status code"); if code != 0 { - println!("{:#?}", std::str::from_utf8(&output.stderr)?); - println!("{:#?}", std::str::from_utf8(&output.stdout)?); panic!("command `{:?}` exited with code {}", cmd, code); }