aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app/api/plugins/mod.rs2
-rw-r--r--tests/client_mode.rs25
-rw-r--r--tests/detach_reattach.rs16
-rw-r--r--tests/multi_client.rs4
-rw-r--r--tests/server_headless.rs4
5 files changed, 25 insertions, 26 deletions
diff --git a/src/app/api/plugins/mod.rs b/src/app/api/plugins/mod.rs
index 3c991f5d..6cc266e3 100644
--- a/src/app/api/plugins/mod.rs
+++ b/src/app/api/plugins/mod.rs
@@ -771,7 +771,7 @@ action = "bootstrap"
assert_eq!(plugin.plugin_id, "example.worktree-bootstrap");
assert_eq!(plugin.name, "Worktree Bootstrap");
assert_eq!(plugin.version, "0.1.0");
- assert_eq!(plugin.plugin_root, root.display().to_string());
+ assert_eq!(plugin.plugin_root, canonical_path_string(&root));
assert!(plugin.enabled);
assert_eq!(plugin.build.len(), 1);
assert_eq!(plugin.build[0].command, ["bun", "install"]);
diff --git a/tests/client_mode.rs b/tests/client_mode.rs
index 64e28c58..99373e38 100644
--- a/tests/client_mode.rs
+++ b/tests/client_mode.rs
@@ -15,8 +15,7 @@ use serde::Deserialize;
use support::{
cleanup_test_base, client_handshake, encode_varint_u16, encode_varint_u32, frame_message,
read_server_message, register_runtime_dir, register_spawned_herdr_pid,
- unregister_spawned_herdr_pid, wait_for_file, wait_for_message_variant, wait_for_socket,
- wait_until,
+ unregister_spawned_herdr_pid, wait_for_message_variant, wait_for_socket, wait_until,
};
fn unique_test_dir() -> PathBuf {
@@ -269,7 +268,7 @@ fn client_connects_and_receives_frame() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -338,7 +337,7 @@ fn client_sees_headless_startup_config_diagnostic() {
child,
};
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
let (version, error) =
@@ -386,7 +385,7 @@ fn client_input_forwarded_to_pane() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -440,7 +439,7 @@ fn client_resize_sends_message() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -499,7 +498,7 @@ fn server_shutdown_sends_message_to_client() {
let mut spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -615,7 +614,7 @@ fn server_crash_after_attach_causes_lost_connection_error() {
let mut spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Attach a real thin client (client subcommand) through PTY so handshake and
// terminal setup paths are exercised.
@@ -731,7 +730,7 @@ fn client_receives_frame_after_pane_output() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -778,7 +777,7 @@ fn navigate_mode_keybind_dispatch_in_server() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -855,7 +854,7 @@ fn pane_spawn_cwd_fallback_in_server() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// The server should have started successfully even though there are
// no existing sessions (fresh state). The test verifies that the
@@ -896,7 +895,7 @@ fn graceful_shutdown_sends_server_shutdown_to_client() {
let mut spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -995,7 +994,7 @@ fn client_receives_notify_on_agent_state_change() {
child,
};
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect as a client and perform handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect");
diff --git a/tests/detach_reattach.rs b/tests/detach_reattach.rs
index a6c3ce84..cfcb5b89 100644
--- a/tests/detach_reattach.rs
+++ b/tests/detach_reattach.rs
@@ -16,7 +16,7 @@ use serde_json::Value;
use support::{
cleanup_test_base, client_handshake, drain_messages, read_server_message, register_runtime_dir,
register_spawned_herdr_pid, send_detach, send_input, unregister_spawned_herdr_pid,
- wait_for_disconnect, wait_for_file, wait_for_message_variant, wait_for_socket, wait_until,
+ wait_for_disconnect, wait_for_message_variant, wait_for_socket, wait_until,
};
fn unique_test_dir() -> PathBuf {
@@ -271,7 +271,7 @@ fn navigate_q_detaches_client_and_server_persists() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket");
@@ -333,7 +333,7 @@ fn explicit_detach_message_causes_clean_disconnect() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect");
@@ -392,7 +392,7 @@ fn reattach_after_detach_shows_current_state() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// --- Client A ---
let mut stream_a = UnixStream::connect(&client_socket).expect("client A should connect");
@@ -504,7 +504,7 @@ fn processes_survive_during_and_after_detach() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Verify server starts with a workspace (session restore or fresh state).
let response = ping_socket(&api_socket);
@@ -599,7 +599,7 @@ fn server_persists_after_client_connection_drop() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake.
let mut stream = UnixStream::connect(&client_socket).expect("should connect");
@@ -649,7 +649,7 @@ fn detached_output_preserves_last_attached_pty_size() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
let mut stream = UnixStream::connect(&client_socket).expect("client should connect");
let (version, error) =
@@ -717,7 +717,7 @@ fn output_accumulated_while_detached_visible_on_reattach() {
let spawned = spawn_server(&config_home, &runtime_dir, &api_socket, &client_socket);
wait_for_socket(&api_socket, Duration::from_secs(10));
- wait_for_file(&client_socket, Duration::from_secs(10));
+ wait_for_socket(&client_socket, Duration::from_secs(10));
// Connect and handshake client A.
let mut stream_a = UnixStream::connect(&client_socket).expect("client A should connect");
diff --git a/tests/multi_client.rs b/tests/multi_client.rs
index cecac406..421a6756 100644
--- a/tests/multi_client.rs
+++ b/tests/multi_client.rs
@@ -94,12 +94,12 @@ fn wait_for_socket(path: &Path, timeout: Duration) {
fn wait_for_file(path: &Path, timeout: Duration) {
let deadline = Instant::now() + timeout;
while Instant::now() < deadline {
- if path.exists() {
+ if path.exists() && UnixStream::connect(path).is_ok() {
return;
}
thread::sleep(Duration::from_millis(25));
}
- panic!("file did not appear at {}", path.display());
+ panic!("socket did not accept connections at {}", path.display());
}
fn spawn_server(config_home: &Path, runtime_dir: &Path, api_socket_path: &Path) -> SpawnedHerdr {
diff --git a/tests/server_headless.rs b/tests/server_headless.rs
index 9420ed65..6e5f03cd 100644
--- a/tests/server_headless.rs
+++ b/tests/server_headless.rs
@@ -88,12 +88,12 @@ fn wait_for_socket(path: &Path, timeout: Duration) {
fn wait_for_file(path: &Path, timeout: Duration) {
let deadline = Instant::now() + timeout;
while Instant::now() < deadline {
- if path.exists() {
+ if path.exists() && UnixStream::connect(path).is_ok() {
return;
}
thread::sleep(Duration::from_millis(25));
}
- panic!("file did not appear at {}", path.display());
+ panic!("socket did not accept connections at {}", path.display());
}
fn spawn_server(