test(host): make two host tests portable to Windows
The Windows host test suite hit two pre-existing portability failures (the autonomous Windows bring-up never ran `cargo test` on the VM): - `vdisplay::detect_active_session_*` asserted a non-empty XDG runtime dir — a Linux concept with no Windows equivalent. Gate just that assertion to Linux (keep the call so the fn stays used → no dead_code). - `mgmt::openapi_document_is_complete_and_checked_in` did a byte compare against the checked-in spec, which git may check out CRLF on Windows while serde_json emits LF. Compare content with `\r` stripped. Host suite now 73/73 on x86_64-pc-windows-msvc; Linux unchanged (78 ok). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1588,9 +1588,11 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let checked_in = include_str!("../../../docs/api/openapi.json");
|
let checked_in = include_str!("../../../docs/api/openapi.json");
|
||||||
|
// Compare content, not line-ending style: the generated `json` is LF (serde_json), but git
|
||||||
|
// may check the file out CRLF on Windows.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
json.trim(),
|
json.trim().replace('\r', ""),
|
||||||
checked_in.trim(),
|
checked_in.trim().replace('\r', ""),
|
||||||
"docs/api/openapi.json is stale — regenerate with: \
|
"docs/api/openapi.json is stale — regenerate with: \
|
||||||
cargo run -p punktfunk-host -- openapi > docs/api/openapi.json"
|
cargo run -p punktfunk-host -- openapi > docs/api/openapi.json"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -638,6 +638,8 @@ mod tests {
|
|||||||
// A pure probe of /proc + the runtime dir: it must not panic and must return promptly on
|
// A pure probe of /proc + the runtime dir: it must not panic and must return promptly on
|
||||||
// any box (CI has no graphical session → ActiveKind::None, with the runtime-dir anchor).
|
// any box (CI has no graphical session → ActiveKind::None, with the runtime-dir anchor).
|
||||||
let a = detect_active_session();
|
let a = detect_active_session();
|
||||||
|
// The runtime-dir anchor is a Linux (XDG) concept; Windows has no equivalent.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
assert!(!a.env.xdg_runtime_dir.is_empty());
|
assert!(!a.env.xdg_runtime_dir.is_empty());
|
||||||
// Wayland sockets are only resolved for the Wayland-protocol desktops.
|
// Wayland sockets are only resolved for the Wayland-protocol desktops.
|
||||||
if matches!(
|
if matches!(
|
||||||
|
|||||||
Reference in New Issue
Block a user