From fedfdf110edb1dd868af1e12fc14b6dcfb945c9d Mon Sep 17 00:00:00 2001 From: Tarek Date: Wed, 12 Jun 2024 23:31:41 +0300 Subject: [PATCH] fix(fs-storage): add delay in tests after file write Signed-off-by: Tarek --- fs-storage/src/file_storage.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs-storage/src/file_storage.rs b/fs-storage/src/file_storage.rs index 276c808c..7fd6e7c1 100644 --- a/fs-storage/src/file_storage.rs +++ b/fs-storage/src/file_storage.rs @@ -368,6 +368,7 @@ mod tests { let mut file_storage = FileStorage::new("TestStorage".to_string(), &storage_path).unwrap(); file_storage.write_fs().unwrap(); + std::thread::sleep(std::time::Duration::from_secs(1)); file_storage.set("key1".to_string(), "value1".to_string()); let before_write = fs::metadata(&storage_path) @@ -375,6 +376,7 @@ mod tests { .modified() .unwrap(); file_storage.write_fs().unwrap(); + std::thread::sleep(std::time::Duration::from_secs(1)); let after_write = fs::metadata(&storage_path) .unwrap() .modified() @@ -395,6 +397,7 @@ mod tests { let mut file_storage = FileStorage::new("TestStorage".to_string(), &storage_path).unwrap(); file_storage.write_fs().unwrap(); + std::thread::sleep(std::time::Duration::from_secs(1)); assert_eq!(file_storage.sync_status().unwrap(), SyncStatus::InSync); file_storage.set("key1".to_string(), "value1".to_string()); @@ -403,6 +406,7 @@ mod tests { SyncStatus::StorageStale ); file_storage.write_fs().unwrap(); + std::thread::sleep(std::time::Duration::from_secs(1)); assert_eq!(file_storage.sync_status().unwrap(), SyncStatus::InSync); // External data manipulation @@ -418,6 +422,7 @@ mod tests { ); mirror_storage.write_fs().unwrap(); + std::thread::sleep(std::time::Duration::from_secs(1)); assert_eq!(mirror_storage.sync_status().unwrap(), SyncStatus::InSync); // receive updates from external data manipulation