diff options
| author | Eric Yue <jiacheng.yue@foxmail.com> | 2026-09-16 20:52:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-16 14:52:48 +0200 |
| commit | 0d14759cb6381b2cfc3fb33ff02761668c8c6405 (patch) | |
| tree | 62c0dcb24d890284ddbe10a38a0dec85f5ac9bce /tests/cli | |
| parent | ab15da285e9d74bea476375f635f73148d551d24 (diff) | |
test: wait for app readiness before late session injection (#4224)
Root cause:
The API socket is bound before App evaluates session restore. Waiting only
for that socket lets the late-session test inject its file during startup,
so the server may load it normally instead of exercising late-file recovery.
The missing backup then fails an otherwise correct persistence assertion.
Fix:
Wait for a read-only workspace-list request to pass through App and assert
that the workspace list is still empty before injecting the session file.
Keep the existing autosave deadline and byte-for-byte backup assertion.
Add no sleeps, retries, longer timeouts or production changes.
Validation:
The original assertion fails with unchanged master. With the barrier, five
independent runs pass. Full native just ci passes 3624 Rust tests with six
default skips, formatting, all-target Clippy, 112 maintenance tests, six
architecture tests and 39 integration-asset tests. All seven docs contract
tests pass. Local Windows cross-lint was not run because its SDK is absent.
Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'tests/cli')
| -rw-r--r-- | tests/cli/sessions.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/cli/sessions.rs b/tests/cli/sessions.rs index 717f02ef..66232ce2 100644 --- a/tests/cli/sessions.rs +++ b/tests/cli/sessions.rs @@ -706,6 +706,9 @@ fn session_appearing_after_startup_is_preserved_before_autosave() { let data_dir = config_home.join(app_dir_name()); let herdr = spawn_herdr(&config_home, &runtime_dir, &socket_path); wait_for_socket(&socket_path, Duration::from_secs(5)); + // The API socket binds before restore; a read-only App request waits for it. + let ready = run_cli_json(&socket_path, &["workspace", "list"]); + assert_eq!(ready["result"]["workspaces"], serde_json::json!([])); // The server has already evaluated restore, but has not created any layout. let original = include_bytes!("../fixtures/session/current-herdr-session.json"); fs::write(data_dir.join("session.json"), original).unwrap(); |
