Skip to content

Commit

Permalink
Merge pull request #21 from thirteenowls/fix-filesystem-space-test-race
Browse files Browse the repository at this point in the history
Fix race in `filesystem_space` test
  • Loading branch information
al8n authored May 26, 2024
2 parents 673a5c6 + ced597c commit eec49c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/file_ext/sync_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod test {

use std::fs;
use super::*;
use crate::{allocation_granularity, available_space, free_space, lock_contended_error, total_space};
use crate::{allocation_granularity, available_space, free_space, lock_contended_error, statvfs, total_space, FsStats};

/// Tests shared file lock operations.
#[test]
Expand Down Expand Up @@ -187,9 +187,12 @@ mod test {
#[test]
fn filesystem_space() {
let tempdir = tempdir::TempDir::new("fs4").unwrap();
let total_space = total_space(tempdir.path()).unwrap();
let free_space = free_space(tempdir.path()).unwrap();
let available_space = available_space(tempdir.path()).unwrap();
let FsStats {
free_space,
available_space,
total_space,
..
} = statvfs(tempdir.path()).unwrap();

assert!(total_space > free_space);
assert!(total_space > available_space);
Expand Down

0 comments on commit eec49c0

Please sign in to comment.