From 9ae86d9c869a5d485bc897a017fa7098c1e30272 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Sat, 24 Oct 2026 23:59:20 +0800 Subject: [PATCH] Retry transient test server requests --- tests/server.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/server.rs b/tests/server.rs index dc6a672..0fdfc8c 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -116,7 +116,21 @@ impl TestServer { } fn request(&self, method: &str, path: &str, body: &[u8], content_type: &str) -> Response { - send(self.port, method, path, body, content_type).expect("HTTP request") + match send(self.port, method, path, body, content_type) { + Ok(response) => response, + Err(first) => { + std::thread::sleep(Duration::from_millis(200)); + match send(self.port, method, path, body, content_type) { + Ok(response) => response, + Err(second) => panic!( + "HTTP request failed twice: {first}; {second} +server log: +{}", + self.log() + ), + } + } + } } fn get(&self, path: &str) -> Response {