From fc0ca1e02947b086eec0615c46807541fa6380f0 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Wed, 25 Nov 2026 21:42:45 +0800 Subject: [PATCH] test(remote): retry the old backend connect until its socket listens (#5910) The daemon's socket file appears at bind(), before listen(), so a connect in between is refused; upgraded_build_refuses_live_work_and_then_replaces_idle_backend failed that way on macOS CI. The helper now retries on ConnectionRefused. --- crates/ide-host/tests/remote_daemon.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/ide-host/tests/remote_daemon.rs b/crates/ide-host/tests/remote_daemon.rs index 42cab893aa..f2dc9144c7 100644 --- a/crates/ide-host/tests/remote_daemon.rs +++ b/crates/ide-host/tests/remote_daemon.rs @@ -745,7 +745,18 @@ async fn upgraded_build_refuses_live_work_and_then_replaces_idle_backend() { .unwrap(); until("old backend socket", || guard.0.exists()).await; let old_open = || async { - let mut stream = UnixStream::connect(&guard.0).await.unwrap(); + // bind() creates the socket file before listen(): a connect in between is refused. + let mut stream = 'connect: { + for _ in 0..600 { + match UnixStream::connect(&guard.0).await { + Err(e) if e.kind() == std::io::ErrorKind::ConnectionRefused => { + tokio::time::sleep(Duration::from_millis(15)).await; + } + other => break 'connect other.unwrap(), + } + } + panic!("the old backend never accepted a connection"); + }; stream.write_all(OLD_BUILD.as_bytes()).await.unwrap(); assert_eq!(stream.read_u8().await.unwrap(), b'A'); let (reader, writer) = stream.into_split();