summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2017-06-27 19:35:55 -0400
committerGraham Christensen <graham@grahamc.com>2017-06-28 19:45:20 -0400
commitb0a4c2c33f7004be50284186b314255b47554edd (patch)
tree46148b29b44d7a942dc7816a2d30a3dce0c00804 /nixos
parentad142902c6feb2852fb472584311bbe8d7c37c00 (diff)
downloadnixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar.gz
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar.bz2
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar.lz
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar.xz
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.tar.zst
nixlib-b0a4c2c33f7004be50284186b314255b47554edd.zip
nixos: installer.nix test: test ZFS install use case
Diffstat (limited to 'nixos')
-rw-r--r--nixos/release-combined.nix1
-rw-r--r--nixos/tests/installer.nix39
2 files changed, 40 insertions, 0 deletions
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index eca2d281342f..49ddd95887be 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 85d31334d6bf..a6afe8a4b72a 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"