avm: force file sync (#1457)

This commit is contained in:
steviez 2022-02-16 21:12:16 -06:00 committed by GitHub
parent f39ea73a65
commit 222c6e3e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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());
}