From f2d08af4d0e943dd14a5986a5a4342b2e7339b5b Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sat, 29 Nov 2025 14:08:33 +0100 Subject: [PATCH] test: capture server stderr to diagnose CI failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - Integration tests are failing in CI with "Server failed to start" - Server stdout/stderr were suppressed, hiding the actual error - Can't diagnose why server won't start in CI environment Changes: - Change stderr from null() to piped() - Capture and print stderr output when server fails to start - Fix redundant pattern matching (is_ok() instead of if let Ok(_)) This will help us see the actual error message from the server in CI logs and diagnose the root cause of the startup failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/integration_test.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/integration_test.rs b/tests/integration_test.rs index d048b45..1b25995 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -15,11 +15,12 @@ impl TestServer { let port = 8080; let base_url = format!("http://0.0.0.0:{}", port); - let process = Command::new("cargo") + // Use piped stderr so we can capture errors if server fails to start + let mut process = Command::new("cargo") .args(["run", "--release", "--"]) .env("RUST_LOG", "error") .stdout(std::process::Stdio::null()) - .stderr(std::process::Stdio::null()) + .stderr(std::process::Stdio::piped()) .spawn() .expect("Failed to start server"); @@ -30,9 +31,10 @@ impl TestServer { let client = reqwest::blocking::Client::new(); let max_retries = 30; for i in 0..max_retries { - if let Ok(_) = client + if client .get(format!("{}/.well-known/openid-configuration", base_url)) .send() + .is_ok() { println!("Server started successfully"); return Self { process, base_url }; @@ -42,6 +44,16 @@ impl TestServer { } } + // Server failed to start - try to get stderr output + use std::io::Read; + if let Some(mut stderr) = process.stderr.take() { + let mut error_output = String::new(); + let _ = stderr.read_to_string(&mut error_output); + if !error_output.is_empty() { + eprintln!("Server stderr output:\n{}", error_output); + } + } + panic!("Server failed to start within timeout"); }