about summary refs log tree commit diff
path: root/nixos/tests/fsck.nix
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2018-08-21 21:39:27 -0400
committerRobin Gloster <mail@glob.in>2018-08-28 17:12:49 +0200
commit94a906b59a7c73f6a0b6ef120f89ee0f927f0dc9 (patch)
tree5607fda8ea37abcf44ae1b23ec211757a1ba3cd9 /nixos/tests/fsck.nix
parent69b4f427b67fe83ddb2bb3ee113770aa802e5643 (diff)
systemd: ensure fsck Requires/After links are created in mount units
systemd-fsck-generator only produces these lines if it can find the
necessary fsck executable in its PATH.

fixes #29139.
Diffstat (limited to 'nixos/tests/fsck.nix')
-rw-r--r--nixos/tests/fsck.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/nixos/tests/fsck.nix b/nixos/tests/fsck.nix
new file mode 100644
index 0000000000000..f943bb7f23500
--- /dev/null
+++ b/nixos/tests/fsck.nix
@@ -0,0 +1,29 @@
+import ./make-test.nix {
+  name = "fsck";
+
+  machine = { lib, ... }: {
+    virtualisation.emptyDiskImages = [ 1 ];
+
+    fileSystems = lib.mkVMOverride {
+      "/mnt" = {
+        device = "/dev/vdb";
+        fsType = "ext4";
+        autoFormat = true;
+      };
+    };
+  };
+
+  testScript = ''
+    $machine->waitForUnit('default.target');
+
+    subtest "root fs is fsckd", sub {
+      $machine->succeed('journalctl -b | grep "fsck.ext4.*/dev/vda"');
+    };
+
+    subtest "mnt fs is fsckd", sub {
+      $machine->succeed('journalctl -b | grep "fsck.*/dev/vdb.*clean"');
+      $machine->succeed('grep "Requires=systemd-fsck@dev-vdb.service" /run/systemd/generator/mnt.mount');
+      $machine->succeed('grep "After=systemd-fsck@dev-vdb.service" /run/systemd/generator/mnt.mount');
+    };
+  '';
+}