summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-08-26 09:07:24 +0200
committerJörg Thalheim <joerg@thalheim.io>2022-08-26 09:12:40 +0200
commit57b7c5506a64e169370f291bffa75d2888027ee9 (patch)
tree291a7a61b8c302af17ad308ebc5a30b8366bdbf3
parent05a90d4227dd14ab08fa3982f320ec771e5626db (diff)
also test zfs filesystem options
-rw-r--r--example/zfs.nix5
-rw-r--r--tests/zfs.nix17
2 files changed, 22 insertions, 0 deletions
diff --git a/example/zfs.nix b/example/zfs.nix
index e344289..2b56bd7 100644
--- a/example/zfs.nix
+++ b/example/zfs.nix
@@ -12,11 +12,16 @@
zroot = {
type = "zpool";
mode = "mirror";
+ rootFsOptions = {
+ compression = "lz4";
+ "com.sun:auto-snapshot" = "false";
+ };
datasets = [
{
type = "zfs_filesystem";
name = "zfs_fs";
mountpoint = "/zfs_fs";
+ options."com.sun:auto-snapshot" = "true";
}
{
type = "zfs_filesystem";
diff --git a/tests/zfs.nix b/tests/zfs.nix
index e0c8fab..ebc6b04 100644
--- a/tests/zfs.nix
+++ b/tests/zfs.nix
@@ -5,6 +5,23 @@ makeDiskoTest {
disko-config = import ../example/zfs.nix;
extraTestScript = ''
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
+
+ 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")
+
+ # FIXME: we cannot mount rootfs yet
+ #machine.succeed("mountpoint /mnt");
+ machine.succeed("mountpoint /mnt/zfs_fs");
+ machine.succeed("mountpoint /mnt/zfs_legacy_fs");
machine.succeed("mountpoint /mnt/ext4onzfs");
'';
}