diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-10 17:11:50 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-10 17:28:31 +0300 |
| commit | 3e8f9df14e6dd08a8d80d920b923870a80649f0b (patch) | |
| tree | ea854ca617d1ca21a09d1e7aa9246ffc5f6e842b /tests/client_mode.rs | |
| parent | 66be0b655fe922867f1eed100a41d67038b6ffd6 (diff) | |
fix: improve config diagnostic delivery
Diffstat (limited to 'tests/client_mode.rs')
| -rw-r--r-- | tests/client_mode.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/client_mode.rs b/tests/client_mode.rs index 016d220e..21978d51 100644 --- a/tests/client_mode.rs +++ b/tests/client_mode.rs @@ -266,9 +266,9 @@ fn read_next_frame_payload(stream: &mut UnixStream, timeout: Duration) -> Result Err("timed out waiting for Frame message".into()) } -fn frame_contains_text(frame: &FrameWire, needle: &str) -> bool { +fn frame_text(frame: &FrameWire) -> String { if frame.cells.is_empty() { - return false; + return String::new(); } let width = frame.width.max(1) as usize; @@ -285,7 +285,7 @@ fn frame_contains_text(frame: &FrameWire, needle: &str) -> bool { let _ = (cursor.x, cursor.y, cursor.visible, cursor.shape); } - text.contains(needle) + text } // --------------------------------------------------------------------------- @@ -391,11 +391,15 @@ fn client_sees_headless_startup_config_diagnostic() { .unwrap(); let deadline = Instant::now() + Duration::from_secs(5); let mut found_diagnostic = false; + let mut last_frame_text = String::new(); while Instant::now() < deadline { match read_server_message(&mut stream) { Ok((1, payload)) => { let frame = decode_frame_payload(&payload).expect("decode frame"); - if frame_contains_text(&frame, "config parse error") { + last_frame_text = frame_text(&frame); + if last_frame_text.contains("config.toml") + && last_frame_text.contains("herdr config check") + { found_diagnostic = true; break; } @@ -407,7 +411,7 @@ fn client_sees_headless_startup_config_diagnostic() { assert!( found_diagnostic, - "attached client should see startup config parse diagnostic" + "attached client should see startup config parse diagnostic; last frame:\n{last_frame_text}" ); cleanup_spawned_herdr(spawned, base); |
