mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
luks: add test for multiple partitions
reproduces #1263 already fails at verifying proper unmounting because the issue exists for both mounting and unmounting
This commit is contained in:
1 parent
ff8702b4de
commit
b8955c9021
3 files changed
+93
No files matched your search
@@ -0,0 +1,65 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/vdb";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "root";
|
||||
extraOpenArgs = [ ];
|
||||
settings = {
|
||||
# if you want to use the key for interactive login be sure there is no trailing newline
|
||||
# for example use `echo -n "password" > /tmp/secret.key`
|
||||
keyFile = "/tmp/secret.key";
|
||||
allowDiscards = true;
|
||||
};
|
||||
additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
home = {
|
||||
size = "100M";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "home";
|
||||
extraOpenArgs = [ ];
|
||||
settings = {
|
||||
# if you want to use the key for interactive login be sure there is no trailing newline
|
||||
# for example use `echo -n "password" > /tmp/secret.key`
|
||||
keyFile = "/tmp/secret.key";
|
||||
allowDiscards = true;
|
||||
};
|
||||
additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/home";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -82,6 +82,8 @@ let
|
||||
efi ? !pkgs.stdenv.hostPlatform.isRiscV64,
|
||||
enableCanokey ? false,
|
||||
postDisko ? "",
|
||||
postUnmountPreMount ? "",
|
||||
postMount ? "",
|
||||
testMode ? "module", # can be one of direct module cli
|
||||
testBoot ? true, # if we actually want to test booting or just create/mount
|
||||
enableOCR ? false,
|
||||
@@ -369,7 +371,9 @@ let
|
||||
machine.succeed("${lib.getExe tsp-mount}") # verify that mount is idempotent
|
||||
machine.succeed("${lib.getExe tsp-unmount}")
|
||||
machine.succeed("${lib.getExe tsp-unmount}") # verify that umount is idempotent
|
||||
${postUnmountPreMount}
|
||||
machine.succeed("${lib.getExe tsp-mount}") # verify that mount is idempotent
|
||||
${postMount}
|
||||
machine.succeed("${lib.getExe tsp-disko} --yes-wipe-all-disks") # verify that we can destroy and recreate
|
||||
machine.succeed("mkdir -p /mnt/home")
|
||||
machine.succeed("touch /mnt/home/testfile")
|
||||
@@ -383,7 +387,9 @@ let
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.mount}") # verify that mount is idempotent
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.unmount}")
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.unmount}") # verify that unmount is idempotent
|
||||
${postUnmountPreMount}
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.mount}") # verify that mount is idempotent
|
||||
${postMount}
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.destroyFormatMount} --yes-wipe-all-disks") # verify that we can destroy and recreate again
|
||||
machine.succeed("mkdir -p /mnt/home")
|
||||
machine.succeed("touch /mnt/home/testfile")
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
diskoLib ? pkgs.callPackage ../lib { },
|
||||
}:
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-multiple";
|
||||
disko-config = ../example/luks-multiple.nix;
|
||||
testBoot = false;
|
||||
postUnmountPreMount = ''
|
||||
machine.fail("mountpoint /mnt/");
|
||||
machine.fail("mountpoint /mnt/home");
|
||||
machine.fail("${pkgs.cryptsetup}/bin/cryptsetup status root")
|
||||
machine.fail("${pkgs.cryptsetup}/bin/cryptsetup status home")
|
||||
'';
|
||||
postMount = ''
|
||||
machine.succeed("mountpoint /mnt/");
|
||||
machine.succeed("mountpoint /mnt/home");
|
||||
machine.succeed("${pkgs.cryptsetup}/bin/cryptsetup status root")
|
||||
machine.succeed("${pkgs.cryptsetup}/bin/cryptsetup status home")
|
||||
'';
|
||||
}
|
||||
Reference in new issue
Block a user