diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/client_mode.rs | 11 | ||||
| -rw-r--r-- | tests/multi_client.rs | 19 |
2 files changed, 11 insertions, 19 deletions
diff --git a/tests/client_mode.rs b/tests/client_mode.rs index 9a6bee7d..a946af7c 100644 --- a/tests/client_mode.rs +++ b/tests/client_mode.rs @@ -1012,12 +1012,15 @@ fn federated_client_starts_without_local_and_survives_its_restart() { local.child.kill().unwrap(); local.close_master(); drop(local); - input - .write_all(b"printf 'REMOTE_%s\\n' SURVIVED\r") - .unwrap(); assert!( wait_until(Duration::from_secs(8), Duration::from_millis(20), || { - screen_text().contains("REMOTE_SURVIVED") + if screen_text().contains("REMOTE_SURVIVED") { + return true; + } + input + .write_all(b"printf 'REMOTE_%s\\n' SURVIVED\r") + .unwrap(); + false }), "Local loss must not interrupt remote input or output: {}", screen_text() diff --git a/tests/multi_client.rs b/tests/multi_client.rs index 823fa0c1..04f5ed0f 100644 --- a/tests/multi_client.rs +++ b/tests/multi_client.rs @@ -75,17 +75,6 @@ fn wait_for_socket(path: &Path, timeout: Duration) { panic!("socket did not appear at {}", path.display()); } -fn wait_for_file(path: &Path, timeout: Duration) { - let deadline = Instant::now() + timeout; - while Instant::now() < deadline { - if path.exists() { - return; - } - thread::sleep(Duration::from_millis(25)); - } - panic!("socket did not appear at {}", path.display()); -} - fn spawn_server(config: &Path, runtime: &Path, api: &Path) -> SpawnedHerdr { fs::create_dir_all(config.join("herdr")).unwrap(); fs::create_dir_all(runtime).unwrap(); @@ -285,7 +274,7 @@ fn same_tab_geometry_follows_meaningful_client_activity() { let clients = runtime.join("herdr-client.sock"); let server = spawn_server(&config, &runtime, &api); wait_for_socket(&api, Duration::from_secs(10)); - wait_for_file(&clients, Duration::from_secs(10)); + wait_for_socket(&clients, Duration::from_secs(10)); let pane = create_pane(&api, "effective-size"); let _large = shell(&clients, 120, 40); let mut small = shell(&clients, 80, 24); @@ -318,7 +307,7 @@ fn api_pane_output_is_fanned_out_as_pane_surface_updates() { let clients = runtime.join("herdr-client.sock"); let server = spawn_server(&config, &runtime, &api); wait_for_socket(&api, Duration::from_secs(10)); - wait_for_file(&clients, Duration::from_secs(10)); + wait_for_socket(&clients, Duration::from_secs(10)); let pane = create_pane(&api, "fanout"); let mut a = shell(&clients, 100, 30); let mut b = shell(&clients, 100, 30); @@ -352,7 +341,7 @@ fn crashed_client_shell_does_not_affect_survivor() { let clients = runtime.join("herdr-client.sock"); let server = spawn_server(&config, &runtime, &api); wait_for_socket(&api, Duration::from_secs(10)); - wait_for_file(&clients, Duration::from_secs(10)); + wait_for_socket(&clients, Duration::from_secs(10)); let mut survivor = shell(&clients, 100, 30); let crashed = spawn_client(&config, &runtime, &api); // Give the supported client process time to complete its ClientShell hello; @@ -385,7 +374,7 @@ fn rapid_client_shell_connect_disconnect_remains_healthy() { let clients = runtime.join("herdr-client.sock"); let server = spawn_server(&config, &runtime, &api); wait_for_socket(&api, Duration::from_secs(10)); - wait_for_file(&clients, Duration::from_secs(10)); + wait_for_socket(&clients, Duration::from_secs(10)); for i in 0..10 { let mut client = shell(&clients, 80 + i, 24); send_detach(&mut client).unwrap(); |
