Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit bbe37c0

Browse files
Brendan McMillionvkrasnov
Brendan McMillion
authored andcommitted
Fix sporadic connect failure in Linux tests.
1 parent ccadcf9 commit bbe37c0

File tree

1 file changed

+17
-2
lines changed
  • src/device/integration_tests

1 file changed

+17
-2
lines changed

src/device/integration_tests/mod.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,24 @@ mod tests {
179179
self.container_name = Some(peer_config_file);
180180
}
181181

182-
fn get_request(&self) -> String {
182+
fn connect(&self) -> std::net::TcpStream {
183183
let http_addr = SocketAddr::new(self.allowed_ips[0].ip, 80);
184-
let mut tcp_conn = std::net::TcpStream::connect(http_addr).unwrap();
184+
for _i in 0..5 {
185+
let res = std::net::TcpStream::connect(http_addr);
186+
if let Err(err) = res {
187+
println!("failed to connect: {:?}", err);
188+
std::thread::sleep(std::time::Duration::from_millis(100));
189+
continue;
190+
}
191+
192+
return res.unwrap();
193+
}
194+
195+
panic!("failed to connect");
196+
}
197+
198+
fn get_request(&self) -> String {
199+
let mut tcp_conn = self.connect();
185200

186201
write!(
187202
tcp_conn,

0 commit comments

Comments
 (0)