mirror of
https://github.com/tobi/disktree.git
synced 2026-11-28 08:00:53 +00:00
test: wait for widening scans to finish before assertions
Co-authored-by: Abdulwahab Isam <5349989+ai94iq@users.noreply.github.com>
This commit is contained in:
co-authored by
Abdulwahab Isam
parent
158f9cc2f0
commit
f7782252c8
@@ -1045,11 +1045,15 @@ fn finish_scan(view: &Entity<Disktree>, cx: &mut Window) {
|
||||
let epoch = read(view, cx, |app| app.scan_epoch);
|
||||
for _ in 0..600 {
|
||||
std::thread::sleep(std::time::Duration::from_millis(5));
|
||||
let ready = update(view, cx, |app, cx| {
|
||||
app.poll_scan_once(epoch, cx);
|
||||
app.tree().is_some()
|
||||
});
|
||||
if ready {
|
||||
// Widening keeps the old tree visible while the new scan runs.
|
||||
// Its presence does not mean the requested scan has completed.
|
||||
let running = update(view, cx, |app, cx| app.poll_scan_once(epoch, cx));
|
||||
if !running {
|
||||
assert!(
|
||||
read(view, cx, |app| app.scan_error.is_none()),
|
||||
"the scan failed"
|
||||
);
|
||||
assert!(read(view, cx, |app| app.tree().is_some()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user