2023-07-28 15:04:18 +03:00
|
|
|
{ pkgs ? import <nixpkgs> { }
|
|
|
|
, diskoLib ? pkgs.callPackage ../lib { }
|
2022-08-25 16:08:26 +03:00
|
|
|
}:
|
2023-07-28 15:04:18 +03:00
|
|
|
diskoLib.testLib.makeDiskoTest {
|
2023-07-14 12:37:30 +03:00
|
|
|
inherit pkgs;
|
2023-02-21 19:19:39 +03:00
|
|
|
name = "zfs";
|
2022-10-29 14:19:29 +03:00
|
|
|
disko-config = ../example/zfs.nix;
|
2023-07-15 17:57:18 +03:00
|
|
|
extraSystemConfig = {
|
2022-09-30 13:55:28 +03:00
|
|
|
fileSystems."/zfs_legacy_fs".options = [ "nofail" ]; # TODO find out why we need this!
|
|
|
|
};
|
2022-08-26 00:12:49 +03:00
|
|
|
extraTestScript = ''
|
2022-08-25 16:08:26 +03:00
|
|
|
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
|
2022-08-26 10:07:24 +03:00
|
|
|
|
|
|
|
def assert_property(ds, property, expected_value):
|
|
|
|
out = machine.succeed(f"zfs get -H {property} {ds} -o value").rstrip()
|
|
|
|
assert (
|
|
|
|
out == expected_value
|
|
|
|
), f"Expected {property}={expected_value} on {ds}, got: {out}"
|
|
|
|
|
|
|
|
assert_property("zroot", "compression", "lz4")
|
|
|
|
assert_property("zroot/zfs_fs", "compression", "lz4")
|
|
|
|
assert_property("zroot", "com.sun:auto-snapshot", "false")
|
|
|
|
assert_property("zroot/zfs_fs", "com.sun:auto-snapshot", "true")
|
|
|
|
assert_property("zroot/zfs_testvolume", "volsize", "10M")
|
2022-08-26 11:28:07 +03:00
|
|
|
assert_property("zroot/zfs_unmounted_fs", "mountpoint", "none")
|
2022-08-26 10:07:24 +03:00
|
|
|
|
2023-04-10 23:52:44 +03:00
|
|
|
machine.succeed("zfs get name zroot@blank")
|
|
|
|
|
2022-09-30 13:55:28 +03:00
|
|
|
machine.succeed("mountpoint /zfs_fs");
|
|
|
|
machine.succeed("mountpoint /zfs_legacy_fs");
|
|
|
|
machine.succeed("mountpoint /ext4onzfs");
|
2022-12-26 19:46:05 +03:00
|
|
|
machine.succeed("mountpoint /zfs_crypted");
|
|
|
|
machine.succeed("zfs get keystatus zroot/encrypted");
|
|
|
|
machine.succeed("zfs get keystatus zroot/encrypted/test");
|
2022-08-25 16:08:26 +03:00
|
|
|
'';
|
|
|
|
}
|