Browse Source

nixos: installer.nix test: test ZFS install use case

nsd-state-dir
Graham Christensen 6 years ago
parent
commit
b0a4c2c33f
No known key found for this signature in database GPG Key ID: 6121D366FE9435C
  1. 1
      nixos/release-combined.nix
  2. 39
      nixos/tests/installer.nix

1
nixos/release-combined.nix

@ -52,6 +52,7 @@ in rec {
(all nixos.tests.firefox)
(all nixos.tests.firewall)
nixos.tests.gnome3.x86_64-linux # FIXME: i686-linux
(all nixos.tests.installer.zfsroot)
(all nixos.tests.installer.lvm)
(all nixos.tests.installer.luksroot)
(all nixos.tests.installer.separateBoot)

39
nixos/tests/installer.nix

@ -171,6 +171,7 @@ let
makeInstallerTest = name:
{ createPartitions, preBootCommands ? "", extraConfig ? ""
, extraInstallerConfig ? {}
, bootLoader ? "grub" # either "grub" or "systemd-boot"
, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid"
, enableOCR ? false, meta ? {}
@ -192,6 +193,7 @@ let
{ imports =
[ ../modules/profiles/installation-device.nix
../modules/profiles/base.nix
extraInstallerConfig
];
virtualisation.diskSize = 8 * 1024;
@ -332,6 +334,43 @@ in {
'';
};
# zfs on / with swap
zfsroot = makeInstallerTest "zfs-root"
{
extraInstallerConfig = {
boot.supportedFilesystems = [ "zfs" ];
};
extraConfig = ''
boot.supportedFilesystems = [ "zfs" ];
# Using by-uuid overrides the default of by-id, and is unique
# to the qemu disks, as they don't produce by-id paths for
# some reason.
boot.zfs.devNodes = "/dev/disk/by-uuid/";
networking.hostId = "00000000";
'';
createPartitions =
''
$machine->succeed(
"parted /dev/vda mklabel msdos",
"parted /dev/vda -- mkpart primary linux-swap 1M 1024M",
"parted /dev/vda -- mkpart primary 1024M -1s",
"udevadm settle",
"mkswap /dev/vda1 -L swap",
"swapon -L swap",
"zpool create rpool /dev/vda2",
"zfs create -o mountpoint=legacy rpool/root",
"mount -t zfs rpool/root /mnt",
"udevadm settle"
);
'';
};
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
lvm = makeInstallerTest "lvm"

Loading…
Cancel
Save