From b0a4c2c33f7004be50284186b314255b47554edd Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 27 Jun 2017 19:35:55 -0400 Subject: nixos: installer.nix test: test ZFS install use case --- nixos/release-combined.nix | 1 + nixos/tests/installer.nix | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'nixos') diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index eca2d281342f8..49ddd95887bed 100644 --- a/nixos/release-combined.nix +++ b/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) diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index 85d31334d6bfc..a6afe8a4b72ad 100644 --- a/nixos/tests/installer.nix +++ b/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" -- cgit 1.4.1