Increase timeout to 2s for fsevents tests

This commit is contained in:
Antonio Scandurra 2021-05-19 15:01:11 +02:00
parent 65cf9b7c1d
commit 1cf5413173

View file

@ -313,16 +313,16 @@ mod tests {
thread::spawn(move || stream.run(move |events| tx.send(events.to_vec()).is_ok()));
// Flush any historical events.
rx.recv_timeout(Duration::from_millis(500)).ok();
rx.recv_timeout(Duration::from_secs(2)).ok();
fs::write(path.join("new-file"), "").unwrap();
let events = rx.recv_timeout(Duration::from_millis(500)).unwrap();
let events = rx.recv_timeout(Duration::from_secs(2)).unwrap();
let event = events.last().unwrap();
assert_eq!(event.path, path.join("new-file"));
assert!(event.flags.contains(StreamFlags::ITEM_CREATED));
fs::remove_file(path.join("existing-file-5")).unwrap();
let events = rx.recv_timeout(Duration::from_millis(500)).unwrap();
let events = rx.recv_timeout(Duration::from_secs(2)).unwrap();
let event = events.last().unwrap();
assert_eq!(event.path, path.join("existing-file-5"));
assert!(event.flags.contains(StreamFlags::ITEM_REMOVED));
@ -356,7 +356,7 @@ mod tests {
assert!(event.flags.contains(StreamFlags::ITEM_CREATED));
fs::remove_file(path.join("existing-file-5")).unwrap();
let events = rx.recv_timeout(Duration::from_millis(500)).unwrap();
let events = rx.recv_timeout(Duration::from_secs(2)).unwrap();
let event = events.last().unwrap();
assert_eq!(event.path, path.join("existing-file-5"));
assert!(event.flags.contains(StreamFlags::ITEM_REMOVED));
@ -383,17 +383,11 @@ mod tests {
});
fs::write(path.join("new-file"), "").unwrap();
assert_eq!(
rx.recv_timeout(Duration::from_millis(500)).unwrap(),
"running"
);
assert_eq!(rx.recv_timeout(Duration::from_secs(2)).unwrap(), "running");
// Dropping the handle causes `EventStream::run` to return.
drop(handle);
assert_eq!(
rx.recv_timeout(Duration::from_millis(500)).unwrap(),
"stopped"
);
assert_eq!(rx.recv_timeout(Duration::from_secs(2)).unwrap(), "stopped");
}
#[test]