mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-08 07:08:44 +00:00
Wait for rename events
This commit is contained in:
@@ -61,7 +61,7 @@ mod tests {
|
|||||||
thread::sleep(Duration::from_millis(200));
|
thread::sleep(Duration::from_millis(200));
|
||||||
fs::remove_file(&new_file_path).expect("Failed to remove file");
|
fs::remove_file(&new_file_path).expect("Failed to remove file");
|
||||||
|
|
||||||
thread::sleep(Duration::from_millis(500));
|
thread::sleep(Duration::from_millis(1500));
|
||||||
watcher.stop().expect("Failed to stop watcher");
|
watcher.stop().expect("Failed to stop watcher");
|
||||||
|
|
||||||
assert_eq!(watcher.status().unwrap().state, WatcherState::Stopped);
|
assert_eq!(watcher.status().unwrap().state, WatcherState::Stopped);
|
||||||
@@ -169,8 +169,13 @@ mod tests {
|
|||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
let new_file = dir.join("b.txt");
|
let new_file = dir.join("b.txt");
|
||||||
fs::rename(&file, &new_file).unwrap();
|
fs::rename(&file, &new_file).unwrap();
|
||||||
thread::sleep(Duration::from_millis(200));
|
thread::sleep(Duration::from_millis(1500));
|
||||||
|
assert!(
|
||||||
|
watcher.status().unwrap().events_processed > 0,
|
||||||
|
"rename event should be processed"
|
||||||
|
);
|
||||||
watcher.stop().unwrap();
|
watcher.stop().unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
let count: i64 = marlin
|
let count: i64 = marlin
|
||||||
.conn()
|
.conn()
|
||||||
@@ -211,8 +216,13 @@ mod tests {
|
|||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
let new = dir.join("newdir");
|
let new = dir.join("newdir");
|
||||||
fs::rename(&sub, &new).unwrap();
|
fs::rename(&sub, &new).unwrap();
|
||||||
thread::sleep(Duration::from_millis(300));
|
thread::sleep(Duration::from_millis(1500));
|
||||||
|
assert!(
|
||||||
|
watcher.status().unwrap().events_processed > 0,
|
||||||
|
"rename event should be processed"
|
||||||
|
);
|
||||||
watcher.stop().unwrap();
|
watcher.stop().unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
for fname in ["one.txt", "two.txt"] {
|
for fname in ["one.txt", "two.txt"] {
|
||||||
let p = new.join(fname);
|
let p = new.join(fname);
|
||||||
|
Reference in New Issue
Block a user