mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-04 01:09:23 +00:00
test(photocraft): give the fake desktop portal time to answer on a loaded pod
The external SVG portal test's client gave every D-Bus call 2 s. Its fake portal answers OpenFile from its own thread after reading the shared file; on a loaded CI pod the call took longer, so a working call failed (run 46849499194: 4 s against 0.3 s on green runs, the code 0 response read as an error). The timeout now only bounds a broken test (60 s), and the assertion prints the error it got. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b35c6c798
commit
f440c29039
1 file changed
+6
-2
@@ -87,7 +87,10 @@ mod tests {
|
||||
let mut address = String::new();
|
||||
std::io::BufReader::new(child.stdout.take().unwrap()).read_line(&mut address).unwrap();
|
||||
let server = zbus::blocking::connection::Builder::address(address.trim()).unwrap().name("org.freedesktop.portal.Desktop").unwrap().build().unwrap();
|
||||
let client = zbus::blocking::connection::Builder::address(address.trim()).unwrap().method_timeout(Duration::from_secs(2)).build().unwrap();
|
||||
// The timeout only bounds a broken test. The fake portal answers OpenFile after reading
|
||||
// the shared file on its own thread; on a loaded CI pod that took over 2 s (run
|
||||
// 46849499194), so a short timeout failed a working call.
|
||||
let client = zbus::blocking::connection::Builder::address(address.trim()).unwrap().method_timeout(Duration::from_secs(60)).build().unwrap();
|
||||
(Bus(child), server, client)
|
||||
}
|
||||
|
||||
@@ -139,7 +142,8 @@ mod tests {
|
||||
panic!("OpenFile was not called");
|
||||
});
|
||||
let (_stop, stopped) = mpsc::channel();
|
||||
assert_eq!(open_on(&client, &owned, &stopped).is_ok(), code == 0);
|
||||
let opened = open_on(&client, &owned, &stopped);
|
||||
assert_eq!(opened.is_ok(), code == 0, "response {code}: {opened:?}");
|
||||
let _server = worker.join().unwrap();
|
||||
assert_eq!(std::fs::read(&owned.file).unwrap(), if code == 0 { b"<svg >" } else { b"<svg/>" });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user