tests cli: use direct mode

This commit is contained in:
lassulus 2023-07-20 19:17:11 +02:00
parent 2b728ffe02
commit 2800cf502a
2 changed files with 11 additions and 21 deletions

View File

@ -46,7 +46,7 @@ let
, extraSystemConfig ? { } , extraSystemConfig ? { }
, efi ? true , efi ? true
, postDisko ? "" , postDisko ? ""
, testMode ? "module" # can be one of direct module cli , testMode ? "module" # can be direct or module
, testBoot ? true # if we actually want to test booting or just create/mount , testBoot ? true # if we actually want to test booting or just create/mount
}: }:
let let
@ -81,7 +81,7 @@ let
installed-system = { modulesPath, ... }: { installed-system = { modulesPath, ... }: {
imports = [ imports = [
(lib.optionalAttrs (testMode == "direct" || testMode == "cli") tsp-config) (lib.optionalAttrs (testMode == "direct") tsp-config)
(lib.optionalAttrs (testMode == "module") { (lib.optionalAttrs (testMode == "module") {
disko.enableConfig = true; disko.enableConfig = true;
imports = [ imports = [
@ -155,13 +155,6 @@ let
devices = testConfigInstall.disko.devices; devices = testConfigInstall.disko.devices;
}; };
}) })
(lib.optionalAttrs (testMode == "cli") {
imports = [ (modulesPath + "/installer/cd-dvd/channel.nix") ];
system.extraDependencies = [
((pkgs.callPackage ../. { checked = true; }).createScript testConfigInstall pkgs)
((pkgs.callPackage ../. { checked = true; }).mountScript testConfigInstall pkgs)
];
})
(modulesPath + "/profiles/base.nix") (modulesPath + "/profiles/base.nix")
(modulesPath + "/profiles/minimal.nix") (modulesPath + "/profiles/minimal.nix")
extraInstallerConfig extraInstallerConfig
@ -219,17 +212,6 @@ let
machine.succeed("${nodes.machine.system.build.mountScript}") # verify that the command is idempotent machine.succeed("${nodes.machine.system.build.mountScript}") # verify that the command is idempotent
machine.succeed("${nodes.machine.system.build.diskoScript}") # verify that we can destroy and recreate again machine.succeed("${nodes.machine.system.build.diskoScript}") # 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
''}
${postDisko} ${postDisko}

View File

@ -8,7 +8,7 @@ makeDiskoTest {
extraSystemConfig = { extraSystemConfig = {
fileSystems."/zfs_legacy_fs".options = [ "nofail" ]; # TODO find out why we need this! fileSystems."/zfs_legacy_fs".options = [ "nofail" ]; # TODO find out why we need this!
}; };
testMode = "cli"; testMode = "direct";
extraTestScript = '' extraTestScript = ''
machine.succeed("test -b /dev/zroot/zfs_testvolume"); machine.succeed("test -b /dev/zroot/zfs_testvolume");
machine.succeed("test -b /dev/md/raid1p1"); machine.succeed("test -b /dev/md/raid1p1");
@ -19,7 +19,15 @@ makeDiskoTest {
machine.succeed("mountpoint /ext4onzfs"); machine.succeed("mountpoint /ext4onzfs");
machine.succeed("mountpoint /ext4_on_lvm"); machine.succeed("mountpoint /ext4_on_lvm");
''; '';
extraSystemConfig = {
imports = [
../module.nix
];
};
extraInstallerConfig = { extraInstallerConfig = {
boot.kernelModules = [ "dm-raid" "dm-mirror" ]; boot.kernelModules = [ "dm-raid" "dm-mirror" ];
imports = [
../module.nix
];
}; };
} }