summary refs log tree commit diff
path: root/nixos/tests/sanoid.nix
diff options
context:
space:
mode:
authorElis Hirwing <elis@hirwing.se>2021-07-26 10:00:14 +0200
committerElis Hirwing <elis@hirwing.se>2021-07-26 11:05:52 +0200
commit764e4acee1e0e48383f8fc2648078e5b0828766a (patch)
tree0042a0e34162f0c78da05e6dc7385bd08198aaa8 /nixos/tests/sanoid.nix
parentbd263441e227e9fa3022abc518504c7b6086b413 (diff)
downloadnixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar.gz
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar.bz2
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar.lz
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar.xz
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.tar.zst
nixpkgs-764e4acee1e0e48383f8fc2648078e5b0828766a.zip
nixos/tests/sanoid: Improve tests by checking that no permissions are left behind
Diffstat (limited to 'nixos/tests/sanoid.nix')
-rw-r--r--nixos/tests/sanoid.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/sanoid.nix b/nixos/tests/sanoid.nix
index 7cef51e4201..3bdbe0a8d8d 100644
--- a/nixos/tests/sanoid.nix
+++ b/nixos/tests/sanoid.nix
@@ -85,10 +85,18 @@ in {
         "chown -R syncoid:syncoid /var/lib/syncoid/",
     )
 
+    assert len(source.succeed("zfs allow pool")) == 0, "Pool shouldn't have delegated permissions set before snapshotting"
+    assert len(source.succeed("zfs allow pool/sanoid")) == 0, "Sanoid dataset shouldn't have delegated permissions set before snapshotting"
+    assert len(source.succeed("zfs allow pool/syncoid")) == 0, "Syncoid dataset shouldn't have delegated permissions set before snapshotting"
+
     # Take snapshot with sanoid
     source.succeed("touch /mnt/pool/sanoid/test.txt")
     source.systemctl("start --wait sanoid.service")
 
+    assert len(source.succeed("zfs allow pool")) == 0, "Pool shouldn't have delegated permissions set after snapshotting"
+    assert len(source.succeed("zfs allow pool/sanoid")) == 0, "Sanoid dataset shouldn't have delegated permissions set after snapshotting"
+    assert len(source.succeed("zfs allow pool/syncoid")) == 0, "Syncoid dataset shouldn't have delegated permissions set after snapshotting"
+
     # Sync snapshots
     target.wait_for_open_port(22)
     source.succeed("touch /mnt/pool/syncoid/test.txt")
@@ -96,5 +104,9 @@ in {
     target.succeed("cat /mnt/pool/sanoid/test.txt")
     source.systemctl("start --wait syncoid-pool-syncoid.service")
     target.succeed("cat /mnt/pool/syncoid/test.txt")
+
+    assert len(source.succeed("zfs allow pool")) == 0, "Pool shouldn't have delegated permissions set after syncing snapshots"
+    assert len(source.succeed("zfs allow pool/sanoid")) == 0, "Sanoid dataset shouldn't have delegated permissions set after syncing snapshots"
+    assert len(source.succeed("zfs allow pool/syncoid")) == 0, "Syncoid dataset shouldn't have delegated permissions set after syncing snapshots"
   '';
 })