From 50ce4ec2ddb8ec621a77d8773aa6df6d9e7441ff Mon Sep 17 00:00:00 2001 From: JJ Liebig Date: Sat, 5 Sep 2026 20:39:32 +0200 Subject: fix: run the full applicable test suite on windows (#3660) * fix: run the full applicable test suite on windows * test: remove redundant test shell assignment * test: make endpoint and metadata fixtures deterministic * test: tolerate exited servers during windows probe cleanup --- src/app/api.rs | 1 + src/app/api/layouts.rs | 4 ++-- src/app/api/worktrees.rs | 7 ++++--- src/app/mod.rs | 22 ++++++++-------------- 4 files changed, 15 insertions(+), 19 deletions(-) (limited to 'src/app') diff --git a/src/app/api.rs b/src/app/api.rs index 598356b0..c504b4c0 100644 --- a/src/app/api.rs +++ b/src/app/api.rs @@ -2207,6 +2207,7 @@ mod tests { crate::api::EventHub::default(), ); let workspace = crate::workspace::Workspace::test_new("restored"); + app.state.default_shell = test_support::exiting_test_command().into(); let pane_id = workspace.tabs[0].root_pane; let terminal_id = workspace.terminal_id(pane_id).cloned().unwrap(); app.state.workspaces = vec![workspace]; diff --git a/src/app/api/layouts.rs b/src/app/api/layouts.rs index 943ed835..74190434 100644 --- a/src/app/api/layouts.rs +++ b/src/app/api/layouts.rs @@ -747,7 +747,7 @@ mod tests { second: Box::new(LayoutNode::Pane { pane: LayoutPane { label: Some("tests".into()), - command: Some(vec!["sh".into(), "-c".into(), "true".into()]), + command: Some(vec![exiting_test_command().into()]), env: std::collections::HashMap::from([( "HERDR_ROLE".into(), "tests".into(), @@ -789,7 +789,7 @@ mod tests { assert_eq!(second_pane.label.as_deref(), Some("tests")); assert_eq!( second_pane.command, - Some(vec!["sh".into(), "-c".into(), "true".into()]) + Some(vec![exiting_test_command().into()]) ); assert!(matches!( &app.event_hub.events_after(0).last().expect("layout event").1.data, diff --git a/src/app/api/worktrees.rs b/src/app/api/worktrees.rs index fd7bb0fb..3c8407b9 100644 --- a/src/app/api/worktrees.rs +++ b/src/app/api/worktrees.rs @@ -794,13 +794,15 @@ mod tests { fn test_app_with_event_hub(event_hub: crate::api::EventHub) -> App { let (_api_tx, api_rx) = tokio::sync::mpsc::unbounded_channel(); - App::new( + let mut app = App::new( &Config::default(), crate::app::AppPolicy::TEST, None, api_rx, event_hub, - ) + ); + app.state.default_shell = test_shell().into(); + app } #[cfg(windows)] @@ -815,7 +817,6 @@ mod tests { fn app_with_parent(repo: &Path) -> App { let mut app = test_app(); - app.state.default_shell = test_shell().into(); let mut parent = Workspace::test_new("main"); parent.identity_cwd = repo.to_path_buf(); app.state.workspaces = vec![parent]; diff --git a/src/app/mod.rs b/src/app/mod.rs index ed2c5fd9..0f78cf8b 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -9,6 +9,8 @@ pub(crate) mod agent_view; mod agents; pub(crate) use agents::{AGENT_START_SETTLE_DELAY, MAX_AGENT_START_TIMEOUT}; mod api; +#[cfg(test)] +pub(crate) use api::test_support::exiting_test_command; mod api_helpers; pub(crate) use api_helpers::limit_snapshot_lines; mod creation; @@ -975,13 +977,15 @@ mod tests { fn test_app() -> App { let (_api_tx, api_rx) = tokio::sync::mpsc::unbounded_channel(); - App::new( + let mut app = App::new( &Config::default(), crate::app::AppPolicy::TEST, None, api_rx, crate::api::EventHub::default(), - ) + ); + app.state.default_shell = exiting_test_command().into(); + app } fn unique_temp_path(name: &str) -> std::path::PathBuf { @@ -992,16 +996,6 @@ mod tests { std::env::temp_dir().join(format!("herdr-{name}-{}-{stamp}", std::process::id())) } - #[cfg(windows)] - fn exiting_test_command() -> &'static str { - "C:\\Windows\\System32\\whoami.exe" - } - - #[cfg(not(windows))] - fn exiting_test_command() -> &'static str { - "/usr/bin/true" - } - fn config_env_lock() -> &'static Mutex<()> { crate::config::test_config_env_lock() } @@ -2657,7 +2651,7 @@ mod tests { async fn pane_split_request_applies_ratio() { let _guard = config_env_lock().lock().unwrap(); let original_shell = std::env::var_os("SHELL"); - std::env::set_var("SHELL", "/usr/bin/true"); + std::env::set_var("SHELL", exiting_test_command()); let mut app = test_app(); let workspace = Workspace::test_new("api-pane-split-ratio"); @@ -2713,7 +2707,7 @@ mod tests { async fn pane_split_request_uses_active_focused_pane_when_target_is_omitted() { let _guard = config_env_lock().lock().unwrap(); let original_shell = std::env::var_os("SHELL"); - std::env::set_var("SHELL", "/usr/bin/true"); + std::env::set_var("SHELL", exiting_test_command()); let mut app = test_app(); let workspace = Workspace::test_new("api-pane-split-current"); -- cgit v1.2.3