Skip to content

Commit

Permalink
Weird bug in file metadata again
Browse files Browse the repository at this point in the history
  • Loading branch information
twitu committed Jun 11, 2024
1 parent 51ff732 commit e55e7e5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions fs-storage/src/file_storage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use std::fs::{self, File};
use std::io::{Write};
use std::io::Write;
use std::time::SystemTime;
use std::{
collections::BTreeMap,
Expand Down Expand Up @@ -307,7 +307,7 @@ where

#[cfg(test)]
mod tests {
use std::{collections::BTreeMap};
use std::{collections::BTreeMap, fs};
use tempdir::TempDir;

use crate::{
Expand Down Expand Up @@ -389,7 +389,18 @@ mod tests {
mirror_storage.sync_status().unwrap(),
SyncStatus::StorageStale
);

let before_write = fs::metadata(&storage_path)
.unwrap()
.modified()
.unwrap();
mirror_storage.write_fs().unwrap();
let after_write = fs::metadata(&storage_path)
.unwrap()
.modified()
.unwrap();
println!("before_write: {:?}, after_write: {:?}", before_write, after_write);
assert!(before_write < after_write);
assert_eq!(mirror_storage.sync_status().unwrap(), SyncStatus::InSync);

// receive updates from external data manipulation
Expand Down

0 comments on commit e55e7e5

Please sign in to comment.