From c77af1892ff121736ecb103b32d504d6f1b31805 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Mon, 14 Sep 2026 03:55:53 +0300 Subject: fix: clean up idle ssh bridges and back off flapping connections (#4083) * fix: clean up idle ssh bridges and back off flapping connections * chore: keep ssh liveness smoke tooling local --- tests/client_mode.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/client_mode.rs b/tests/client_mode.rs index 8f326484..d3205e5a 100644 --- a/tests/client_mode.rs +++ b/tests/client_mode.rs @@ -889,9 +889,10 @@ fn federated_client_starts_without_local_and_survives_its_restart() { std::os::unix::fs::symlink(env!("CARGO_BIN_EXE_herdr"), bin.join("herdr")).unwrap(); let quote = |path: &std::path::Path| format!("'{}'", path.display().to_string().replace('\'', "'\\''")); + let ssh_commands = base.join("ssh-commands"); fs::write(bin.join("ssh"), format!( - "#!/bin/sh\nexport HOME={} XDG_CONFIG_HOME={} XDG_RUNTIME_DIR={} HERDR_SOCKET_PATH={}\nunset HERDR_CLIENT_SOCKET_PATH HERDR_SESSION\nfor arg do last=\"$arg\"; done\nexec /bin/sh -c \"$last\"\n", - quote(&base.join("home")), quote(&remote_config), quote(&remote_runtime), quote(&remote_api), + "#!/bin/sh\nexport HOME={} XDG_CONFIG_HOME={} XDG_RUNTIME_DIR={} HERDR_SOCKET_PATH={}\nunset HERDR_CLIENT_SOCKET_PATH HERDR_SESSION\nfor arg do last=\"$arg\"; done\nprintf '%s\\n' \"$last\" >> {}\nexec /bin/sh -c \"$last\"\n", + quote(&base.join("home")), quote(&remote_config), quote(&remote_runtime), quote(&remote_api), quote(&ssh_commands), )).unwrap(); fs::set_permissions(bin.join("ssh"), fs::Permissions::from_mode(0o700)).unwrap(); let path = format!( @@ -914,6 +915,12 @@ fn federated_client_starts_without_local_and_survives_its_restart() { "remote must be usable before Local exists: {}", read_output(&output) ); + assert!( + fs::read_to_string(&ssh_commands) + .unwrap() + .contains("remote-client-bridge --idle-timeout-v1"), + "saved machine discovery must opt into the advertised bridge idle timeout" + ); let mut local = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket); wait_for_socket(&api_socket, Duration::from_secs(10)); -- cgit v1.2.3