Retry transient test server requests
This commit is contained in:
1 parent
5b160f9780
commit
9ae86d9c86
1 file changed
+15
-1
+15
-1
@@ -116,7 +116,21 @@ impl TestServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn request(&self, method: &str, path: &str, body: &[u8], content_type: &str) -> Response {
|
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 {
|
fn get(&self, path: &str) -> Response {
|
||||||
|
|||||||
Reference in new issue
Block a user