From 30b7158f2a059e4fd1a0f63ecc781bdbcdb39b1c Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sat, 29 Nov 2025 15:09:42 +0100 Subject: [PATCH] test: fix binary path detection in integration tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update TestServer::start() to properly locate the barycenter binary by navigating from target/debug/deps/ (test binary location) up to target/debug/ where the main binary resides. This fixes the "No such file or directory" errors that were causing all integration tests to fail. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/integration_test.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 1b25995..4c72187 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -15,17 +15,32 @@ impl TestServer { let port = 8080; let base_url = format!("http://0.0.0.0:{}", port); + // Use the pre-built binary from target/debug instead of recompiling with cargo run + // This avoids compilation timeouts in CI + // The test binary is in target/debug/deps/, we need to go up to target/debug/ + let binary_path = std::env::current_exe() + .ok() + .and_then(|p| { + // Go up from target/debug/deps/test-binary to target/debug + p.parent() + .and_then(|p| p.parent()) + .map(|p| p.join("barycenter")) + }) + .unwrap_or_else(|| { + // Fallback to relative path + std::path::PathBuf::from("target/debug/barycenter") + }); + // Use piped stderr so we can capture errors if server fails to start - let mut process = Command::new("cargo") - .args(["run", "--release", "--"]) + let mut process = Command::new(&binary_path) .env("RUST_LOG", "error") .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::piped()) .spawn() .expect("Failed to start server"); - // Wait for server to start - give it more time for first compilation - thread::sleep(Duration::from_secs(5)); + // Wait for server to start + thread::sleep(Duration::from_secs(2)); // Verify server is running by checking discovery endpoint let client = reqwest::blocking::Client::new();