Include relay output when startup metric tests fail

Signed-off-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
Tom Brow
2026-10-12 13:57:59 -07:00
parent fd32a67a6f
commit 927bca59f3

View File

@@ -170,10 +170,15 @@ fn wait_for_relay_metrics(process: &mut RelayProcess, port: u16) -> String {
fn wait_for_scraped_metric(process: &mut RelayProcess, port: u16, needle: &str) -> String {
let deadline = Instant::now() + METRICS_SCRAPE_DEADLINE;
loop {
assert!(
process.try_wait().is_none(),
"relay exited before exporting {needle}"
);
if let Some(status) = process.try_wait() {
let stdout = join_capture(process.stdout.take(), "stdout");
let stderr = join_capture(process.stderr.take(), "stderr");
panic!(
"relay exited ({status}) before exporting {needle}\nstdout: {}\nstderr: {}",
String::from_utf8_lossy(&stdout),
String::from_utf8_lossy(&stderr),
);
}
if let Ok(response) = scrape_metrics(port) {
if response.contains(needle) {
return response;