diff options
author | lassulus <lassulus@lassul.us> | 2022-08-25 13:13:20 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-08-25 15:32:09 +0200 |
commit | 1237ac36db1a457ae561134d191d2924a9ce5ffc (patch) | |
tree | 893e0455554e2a98244b8a7f94363b11007f0b59 /tests/mdadm.nix | |
parent | 6b0b20da18cdffd09f04faee7128c557bcb9f054 (diff) |
fix mdadm mounting, move test to mdadm test
Diffstat (limited to 'tests/mdadm.nix')
-rw-r--r-- | tests/mdadm.nix | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/mdadm.nix b/tests/mdadm.nix new file mode 100644 index 0000000..37465e4 --- /dev/null +++ b/tests/mdadm.nix @@ -0,0 +1,39 @@ +{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix> +, pkgs ? (import <nixpkgs> {}) +}: +let + makeTest' = args: + makeTest args { + inherit pkgs; + inherit (pkgs) system; + }; + 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' { + name = "disko"; + + nodes.machine = + { config, pkgs, modulesPath, ... }: + + { + imports = [ + (modulesPath + "/profiles/installation-device.nix") + (modulesPath + "/profiles/base.nix") + ]; + + # speed-up eval + documentation.enable = false; + + virtualisation.emptyDiskImages = [ 512 512 ]; + }; + + testScript = '' + machine.succeed("echo 'secret' > /tmp/secret.key"); + machine.succeed("${tsp-create}"); + 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"); + ''; +} |