docs(plan): sync M4 lifecycle test with SPACESH_SOCK serial-guard fix
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -275,18 +275,18 @@ pub fn socket_path() -> Result<PathBuf> {
|
|||||||
Ok(spacesh_dir()?.join("sock"))
|
Ok(spacesh_dir()?.join("sock"))
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Add a test in `lifecycle.rs` tests module:
|
Add a test in `lifecycle.rs` tests module. It mutates the process-global `SPACESH_SOCK`, so it MUST hold `crate::test_support::serial()` for its duration; ALSO add the same guard to the existing `paths_live_under_spacesh_dir` test (the only other test that calls `socket_path()`), or it will intermittently observe the override var and fail:
|
||||||
```rust
|
```rust
|
||||||
#[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.
|
|
||||||
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");
|
||||||
assert_eq!(p, std::path::PathBuf::from("/tmp/spacesh-test-override.sock"));
|
assert_eq!(p, std::path::PathBuf::from("/tmp/spacesh-test-override.sock"));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
And prepend `let _serial = crate::test_support::serial();` as the first line of the existing `paths_live_under_spacesh_dir` test.
|
||||||
|
|
||||||
- [ ] **Step 4: Initialize idle on every spawn; drop on exit; dispatch SetState**
|
- [ ] **Step 4: Initialize idle on every spawn; drop on exit; dispatch SetState**
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user