test(daemon): serialize SPACESH_SOCK-mutating lifecycle tests to fix env race

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 22:23:41 +07:00
parent 6f2e7885a4
commit 6fc099bb6f
+4 -2
View File
@@ -56,6 +56,7 @@ mod tests {
#[test] #[test]
fn paths_live_under_spacesh_dir() { fn paths_live_under_spacesh_dir() {
let _serial = crate::test_support::serial();
let dir = spacesh_dir().unwrap(); let dir = spacesh_dir().unwrap();
assert!(socket_path().unwrap().starts_with(&dir)); assert!(socket_path().unwrap().starts_with(&dir));
assert!(lock_path().unwrap().starts_with(&dir)); assert!(lock_path().unwrap().starts_with(&dir));
@@ -75,8 +76,9 @@ mod tests {
#[test] #[test]
fn socket_path_honors_env_override() { fn socket_path_honors_env_override() {
// Note: set/remove around the assertion; tests in this module run serially enough, let _serial = crate::test_support::serial();
// but guard by restoring afterwards. // Note: set/remove around the assertion; serialized against the other
// env-sensitive lifecycle test via the crate's serial() lock.
std::env::set_var("SPACESH_SOCK", "/tmp/spacesh-test-override.sock"); std::env::set_var("SPACESH_SOCK", "/tmp/spacesh-test-override.sock");
let p = socket_path().unwrap(); let p = socket_path().unwrap();
std::env::remove_var("SPACESH_SOCK"); std::env::remove_var("SPACESH_SOCK");