summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-08-25 18:36:56 +0200
committerlassulus <lassulus@lassul.us>2022-08-25 23:31:05 +0200
commitdadc49133042834dada6eafc98dcb1f7f2c5e43b (patch)
treef1ffb90380a1a6d628d8c786857e606350a2633c /tests
parent0ffaac7913565e497c5193d45fd50de78f3241f0 (diff)
add lvm raid
Diffstat (limited to 'tests')
-rw-r--r--tests/lvm-raid.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lvm-raid.nix b/tests/lvm-raid.nix
new file mode 100644
index 0000000..5165645
--- /dev/null
+++ b/tests/lvm-raid.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/lvm-raid.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 ];
+ boot.kernelModules = [ "dm-raid" "dm-mirror" ];
+ };
+
+ 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("grep -qs '/mnt/home' /proc/mounts");
+ '';
+}