From 1ac0e76b15a3b13c83d25a78b32dee4070a584b7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 23:12:49 +0200 Subject: tests: add lib, autoimport tests --- tests/mdadm.nix | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) (limited to 'tests/mdadm.nix') diff --git a/tests/mdadm.nix b/tests/mdadm.nix index 37465e4..72f2faf 100644 --- a/tests/mdadm.nix +++ b/tests/mdadm.nix @@ -1,38 +1,9 @@ -{ makeTest ? import -, pkgs ? (import {}) +{ pkgs ? (import {}) +, makeDiskoTest ? (pkgs.callPackage ./lib.nix {}).makeDiskoTest }: -let - makeTest' = args: - makeTest args { - inherit pkgs; - inherit (pkgs) system; - }; +makeDiskoTest { 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 + extraTestScript = '' machine.succeed("test -b /dev/md/raid1"); machine.succeed("grep -qs '/mnt/raid' /proc/mounts"); ''; -- cgit v1.2.3