Skip to content

Commit d849da2

Browse files
committed
Add a retry loop to index_page_unix test
1 parent f5dbb97 commit d849da2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/tests.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::net::{SocketAddr, ToSocketAddrs};
66
use std::path::PathBuf;
77
use std::process::{Command, Stdio};
88
use std::sync::atomic::{AtomicU16, Ordering};
9+
use std::thread::sleep;
10+
use std::time::Duration;
911
use tokio_rustls::rustls;
1012
use url::Url;
1113

@@ -201,8 +203,13 @@ fn index_page_unix() {
201203
"example.com".try_into().unwrap(),
202204
)
203205
.unwrap();
204-
let mut unix =
205-
std::os::unix::net::UnixStream::connect(sock_path).expect("could not connect unix socket");
206+
207+
let mut unix = loop {
208+
if let Ok(sock) = std::os::unix::net::UnixStream::connect(&sock_path) {
209+
break sock;
210+
}
211+
sleep(Duration::from_millis(10));
212+
};
206213
let mut tls = rustls::Stream::new(&mut session, &mut unix);
207214

208215
write!(tls, "gemini://example.com\r\n").unwrap();

0 commit comments

Comments
 (0)