diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2022-12-25 18:25:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-25 18:25:37 +0000 |
commit | e3527b826d9ce94855cd0f2716c46cef76a4219a (patch) | |
tree | d63f70120437bb4fdcc4d0b656c674e533c6abea /tests | |
parent | 11d5c74c30cec9783d8281a3af51d269ac7f3eab (diff) | |
parent | 164ea97c01ae57ecb76153ef43be4a184aa5d33a (diff) |
zap only devices we care about
Diffstat (limited to 'tests')
-rw-r--r-- | tests/default.nix | 2 | ||||
-rw-r--r-- | tests/lib.nix | 11 | ||||
-rw-r--r-- | tests/swap.nix | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/tests/default.nix b/tests/default.nix index c10cf76..c7c15a5 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -20,7 +20,7 @@ let (lib.attrNames (builtins.readDir ./.)) ); - allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; }) // + allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest pkgs; }) // evalTest "lvm-luks-example" ../example/config.nix // { standalone = (pkgs.nixos [ ../example/stand-alone/configuration.nix ]).config.system.build.toplevel; }; diff --git a/tests/lib.nix b/tests/lib.nix index 4b81da7..80ad0e3 100644 --- a/tests/lib.nix +++ b/tests/lib.nix @@ -26,6 +26,7 @@ tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create (import disko-config { disks = builtins.tail disks; inherit lib; })); tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount (import disko-config { disks = builtins.tail disks; inherit lib; })); tsp-config = (pkgs.callPackage ../. { }).config (import disko-config { inherit disks; inherit lib; }); + tsp-disko = pkgs.writeScript "disko" ((pkgs.callPackage ../. { }).zapCreateMount (import disko-config { disks = builtins.tail disks; inherit lib; })); num-disks = builtins.length (lib.attrNames (import disko-config { inherit lib; }).disk); installed-system = { modulesPath, ... }: { imports = [ @@ -60,9 +61,6 @@ efiSupport = efi; efiInstallAsRemovable = efi; }; - environment.systemPackages = [ - pkgs.jq - ]; }; installedTopLevel = (eval-config { modules = [ installed-system ]; @@ -93,6 +91,9 @@ (modulesPath + "/profiles/minimal.nix") extraConfig ]; + environment.systemPackages = [ + pkgs.jq + ]; # speed-up eval documentation.enable = false; @@ -127,20 +128,24 @@ machine.succeed("${tsp-create}") machine.succeed("${tsp-mount}") machine.succeed("${tsp-mount}") # verify that the command is idempotent + machine.succeed("${tsp-disko}") # verify that we can destroy and recreate ''} ${lib.optionalString (testMode == "module") '' machine.succeed("${nodes.machine.system.build.formatScript}") machine.succeed("${nodes.machine.system.build.mountScript}") machine.succeed("${nodes.machine.system.build.mountScript}") # verify that the command is idempotent + machine.succeed("${nodes.machine.system.build.disko}") # verify that we can destroy and recreate again ''} ${lib.optionalString (testMode == "cli") '' # TODO use the disko cli here # machine.succeed("${../.}/disko --no-pkgs --mode create ${disko-config}") # machine.succeed("${../.}/disko --no-pkgs --mode mount ${disko-config}") # machine.succeed("${../.}/disko --no-pkgs --mode mount ${disko-config}") # verify that the command is idempotent + # machine.succeed("${../.}/disko --no-pkgs --mode zap_create_mount ${disko-config}") # verify that we can destroy and recreate again machine.succeed("${tsp-create}") machine.succeed("${tsp-mount}") machine.succeed("${tsp-mount}") # verify that the command is idempotent + machine.succeed("${tsp-disko}") # verify that we can destroy and recreate ''} ${lib.optionalString testBoot '' diff --git a/tests/swap.nix b/tests/swap.nix index d3268dc..4861f8d 100644 --- a/tests/swap.nix +++ b/tests/swap.nix @@ -16,4 +16,7 @@ makeDiskoTest { ' """); ''; + extraConfig = { + environment.systemPackages = [ pkgs.jq ]; + }; } |