Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test loopbacked #3609

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
components: cargo
runs-on: ubuntu-22.04
container:
image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT
image: fedora:40 # CURRENT DEVELOPMENT ENVIRONMENT
options: --privileged -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
components: cargo
runs-on: ubuntu-22.04
container:
image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT
image: fedora:40 # CURRENT DEVELOPMENT ENVIRONMENT
options: --privileged -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev --ipc=host
steps:
- uses: actions/checkout@v4
Expand Down
33 changes: 20 additions & 13 deletions src/engine/strat_engine/thinpool/thinpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2590,14 +2590,14 @@ mod tests {
pool_name,
pool_uuid,
"stratis_test_filesystem",
Sectors::from(1200 * IEC::Ki),
// 700 * IEC::Mi
Some(Sectors(1400 * IEC::Ki)),
Sectors::from(2400 * IEC::Ki),
// 1400 * IEC::Mi
Some(Sectors(2800 * IEC::Ki)),
)
.unwrap();
let devnode = {
let (_, fs) = pool.get_mut_filesystem_by_uuid(fs_uuid).unwrap();
assert_eq!(fs.size_limit(), Some(Sectors(1400 * IEC::Ki)));
assert_eq!(fs.size_limit(), Some(Sectors(2800 * IEC::Ki)));
fs.devnode()
};

Expand All @@ -2621,8 +2621,8 @@ mod tests {
.open(new_file)
.unwrap();
let mut bytes_written = Bytes(0);
// Write 400 * IEC::Mi
while bytes_written < Bytes::from(400 * IEC::Mi) {
// Write 800 * IEC::Mi
while bytes_written < Bytes::from(800 * IEC::Mi) {
file.write_all(&[1; 4096]).unwrap();
bytes_written += Bytes(4096);
}
Expand All @@ -2634,13 +2634,20 @@ mod tests {
assert_eq!(fs.size_limit(), Some(fs.size().sectors()));
}

// 800 * IEC::Mi
pool.set_fs_size_limit(fs_uuid, Some(Sectors(1600 * IEC::Ki)))
// 1600 * IEC::Mi
pool.set_fs_size_limit(fs_uuid, Some(Sectors(3200 * IEC::Ki)))
.unwrap();
{
let (_, fs) = pool.get_mut_filesystem_by_uuid(fs_uuid).unwrap();
assert_eq!(fs.size_limit(), Some(Sectors(1600 * IEC::Ki)));
assert_eq!(fs.size_limit(), Some(Sectors(3200 * IEC::Ki)));
}
let mut bytes_written = Bytes(0);
// Write 200 * IEC::Mi
while bytes_written < Bytes::from(200 * IEC::Mi) {
file.write_all(&[1; 4096]).unwrap();
bytes_written += Bytes(4096);
}
file.sync_all().unwrap();
pool.check_fs(pool_uuid, &backstore).unwrap();

{
Expand All @@ -2652,7 +2659,7 @@ mod tests {
let (_, fs) = pool
.snapshot_filesystem(pool_name, pool_uuid, fs_uuid, "snapshot")
.unwrap();
assert_eq!(fs.size_limit(), Some(Sectors(1600 * IEC::Ki)));
assert_eq!(fs.size_limit(), Some(Sectors(3200 * IEC::Ki)));
}

pool.set_fs_size_limit(fs_uuid, None).unwrap();
Expand All @@ -2661,8 +2668,8 @@ mod tests {
assert_eq!(fs.size_limit(), None);
}
let mut bytes_written = Bytes(0);
// Write 200 * IEC::Mi
while bytes_written < Bytes::from(200 * IEC::Mi) {
// Write 400 * IEC::Mi
while bytes_written < Bytes::from(400 * IEC::Mi) {
file.write_all(&[1; 4096]).unwrap();
bytes_written += Bytes(4096);
}
Expand All @@ -2671,7 +2678,7 @@ mod tests {

{
let (_, fs) = pool.get_mut_filesystem_by_uuid(fs_uuid).unwrap();
assert_eq!(fs.size().sectors(), Sectors(3200 * IEC::Ki));
assert_eq!(fs.size().sectors(), Sectors(6400 * IEC::Ki));
}

assert!(pool.set_fs_size_limit(fs_uuid, Some(Sectors(50))).is_err());
Expand Down
Loading