From 1237ac36db1a457ae561134d191d2924a9ce5ffc Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 13:13:20 +0200 Subject: [PATCH] fix mdadm mounting, move test to mdadm test --- default.nix | 5 +++-- example/{raid.nix => mdadm.nix} | 1 - tests/{test.nix => mdadm.nix} | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) rename example/{raid.nix => mdadm.nix} (99%) rename tests/{test.nix => mdadm.nix} (90%) diff --git a/default.nix b/default.nix index d20b67e..567324c 100644 --- a/default.nix +++ b/default.nix @@ -137,7 +137,7 @@ let }; mount.devices = q: x: let - z = foldl' recursiveUpdate {} (mapAttrsToList (name: mount-f { device = "/dev/${name}"; }) x.content); + z = foldl' recursiveUpdate {} (mapAttrsToList (name: mount-f { device = "/dev/${name}"; inherit name; }) x.content); # attrValues returns values sorted by name. This is important, because it # ensures that "/" is processed before "/foo" etc. in '' @@ -168,8 +168,9 @@ let mount.noop = q: x: {}; + mount.mdadm = q: x: + mount-f { device = "/dev/md/${q.name}"; } x.content; # TODO maybe we need to do something here? - mount.mdadm = mount.noop; mount.mdraid = mount.noop; mount.partition = q: x: diff --git a/example/raid.nix b/example/mdadm.nix similarity index 99% rename from example/raid.nix rename to example/mdadm.nix index 490ea01..cb0ad91 100644 --- a/example/raid.nix +++ b/example/mdadm.nix @@ -53,7 +53,6 @@ }; } ]; - }; }; }; diff --git a/tests/test.nix b/tests/mdadm.nix similarity index 90% rename from tests/test.nix rename to tests/mdadm.nix index 1384590..37465e4 100644 --- a/tests/test.nix +++ b/tests/mdadm.nix @@ -7,7 +7,7 @@ let inherit pkgs; inherit (pkgs) system; }; - disko-config = import ../example/raid.nix; + disko-config = import ../example/mdadm.nix; tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. {}).create disko-config); tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. {}).mount disko-config); in makeTest' { @@ -34,5 +34,6 @@ in makeTest' { machine.succeed("${tsp-mount}"); machine.succeed("${tsp-mount}"); # verify that the command is idempotent machine.succeed("test -b /dev/md/raid1"); + machine.succeed("grep -qs '/mnt/raid' /proc/mounts"); ''; }