diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-16 15:16:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-16 15:16:45 +0300 |
| commit | d1a53b2c0e7a365c20a524d75906ae83c6094458 (patch) | |
| tree | 867b7ffb30c70d60ddad3b20975550dda21ca96f /src/client/shell/tests/endpoint_requests.rs | |
| parent | 18061191fdc019498610aee81f0df93f6c2ebd31 (diff) | |
fix: keep local usable when remote machines stall (#4234)
refs #3903
Diffstat (limited to 'src/client/shell/tests/endpoint_requests.rs')
| -rw-r--r-- | src/client/shell/tests/endpoint_requests.rs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/client/shell/tests/endpoint_requests.rs b/src/client/shell/tests/endpoint_requests.rs index b8805596..1f51f06c 100644 --- a/src/client/shell/tests/endpoint_requests.rs +++ b/src/client/shell/tests/endpoint_requests.rs @@ -259,6 +259,42 @@ impl crate::client::endpoint::EndpointTransport for TestTransport { } #[test] +fn local_selection_is_scheduled_ahead_of_a_full_event_queue() { + use crate::client::{ + endpoint::{EndpointNegotiation, EndpointRegistry}, + endpoint_commands::EndpointCommands, + ClientLoopEvent, + }; + let mut endpoints = EndpointRegistry::new( + TestTransport { fail: false }, + 1, + EndpointNegotiation::default(), + ); + let mut commands = EndpointCommands::default(); + let (tx, mut rx) = tokio::sync::mpsc::channel(1); + tx.try_send(ClientLoopEvent::Timer).unwrap(); + let mut scheduled = None; + crate::client::shell_runtime::dispatch_client_shell_actions( + vec![ClientShellAction::ActivateEndpoint { + endpoint_id: ClientEndpointId::Local, + target: Some(ClientEndpointFocusTarget::Workspace("ws_1".into())), + }], + &mut commands, + &mut endpoints, + None, + &mut Vec::new(), + &mut scheduled, + ) + .unwrap(); + let next = scheduled.take().or_else(|| rx.try_recv().ok()); + assert!(matches!(next, Some(ClientLoopEvent::ActivateEndpoint { + endpoint_id: ClientEndpointId::Local, + target: Some(ClientEndpointFocusTarget::Workspace(id)), .. + }) if id == "ws_1")); + assert!(matches!(rx.try_recv(), Ok(ClientLoopEvent::Timer))); +} + +#[test] fn dispatcher_cancels_worktree_requests_on_frozen_surface_or_failed_send() { use crate::client::endpoint::{EndpointNegotiation, EndpointRegistry}; use crate::client::endpoint_commands::EndpointCommands; @@ -272,14 +308,14 @@ fn dispatcher_cancels_worktree_requests_on_frozen_surface_or_failed_send() { ); endpoints.set_surface_active(&ClientEndpointId::Local, fail_send); let mut commands = EndpointCommands::default(); - let (tx, _rx) = tokio::sync::mpsc::channel(16); + let mut scheduled = None; let (replay, repaint) = crate::client::shell_runtime::dispatch_client_shell_actions( actions, &mut commands, &mut endpoints, Some(&mut state), &mut Vec::new(), - &tx, + &mut scheduled, ) .unwrap(); assert!(repaint); |
