Browse Source

avm: force file sync (#1457)

steviez 3 years ago
parent
commit
222c6e3e55
1 changed files with 3 additions and 0 deletions
  1. 3 0
      avm/src/lib.rs

+ 3 - 0
avm/src/lib.rs

@@ -261,6 +261,9 @@ mod tests {
         let mut current_version_file =
             fs::File::create(current_version_file_path().as_path()).unwrap();
         current_version_file.write_all("0.18.2".as_bytes()).unwrap();
+        // Sync the file to disk before the read in current_version() to
+        // mitigate the read not seeing the written version bytes.
+        current_version_file.sync_all().unwrap();
         assert!(current_version().unwrap() == Version::parse("0.18.2").unwrap());
     }