mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
tests: Move example tests to dedicated folder
This commit is contained in:
1 parent
389235b63f
commit
737e045f53
40 files changed
+58
-43
No files matched your search
File renamed without changes.
@@ -86,6 +86,7 @@
|
||||
ps.isort # Import sorter
|
||||
ps.mypy # Static type checker
|
||||
ps.autoflake # Remove unused imports automatically
|
||||
ps.pytest # Test runner
|
||||
]))
|
||||
];
|
||||
};
|
||||
|
||||
Whitespace-only changes.
+19
-8
@@ -4,17 +4,28 @@
|
||||
}:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
fs = lib.fileset;
|
||||
diskoLib = import ../src/disko_lib { inherit lib makeTest eval-config; };
|
||||
|
||||
allTestFilenames =
|
||||
builtins.map (lib.removeSuffix ".nix") (
|
||||
builtins.filter
|
||||
(x: lib.hasSuffix ".nix" x && x != "default.nix")
|
||||
(lib.attrNames (builtins.readDir ./.))
|
||||
);
|
||||
incompatibleTests = lib.optionals pkgs.buildPlatform.isRiscV64 [ "zfs" "zfs-over-legacy" "cli" "module" "complex" ];
|
||||
allCompatibleFilenames = lib.subtractLists incompatibleTests allTestFilenames;
|
||||
|
||||
allTests = lib.genAttrs allCompatibleFilenames (test: import (./. + "/${test}.nix") { inherit diskoLib pkgs; });
|
||||
allTestFilenames =
|
||||
(fs.toList
|
||||
(fs.difference
|
||||
(fs.fileFilter
|
||||
({ name, hasExt, ... }:
|
||||
hasExt "nix"
|
||||
&& name != "default.nix"
|
||||
&& !(lib.elem (lib.removeSuffix ".nix" name) incompatibleTests))
|
||||
./.)
|
||||
(fs.fileFilter ({ ... }: true) ./disko-install))
|
||||
);
|
||||
|
||||
allTests = lib.listToAttrs (lib.map
|
||||
(test: {
|
||||
name = lib.removeSuffix ".nix" (builtins.baseNameOf test);
|
||||
value = import test { inherit diskoLib pkgs; };
|
||||
})
|
||||
allTestFilenames);
|
||||
in
|
||||
allTests
|
||||
@@ -0,0 +1,3 @@
|
||||
# Tests for all example files
|
||||
|
||||
You can check out the examples tested here in [../../example](../../example/).
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "bcachefs";
|
||||
disko-config = ../example/bcachefs.nix;
|
||||
disko-config = ../../example/bcachefs.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("lsblk >&2");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "boot-raid1";
|
||||
disko-config = ../example/boot-raid1.nix;
|
||||
disko-config = ../../example/boot-raid1.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -b /dev/md/boot");
|
||||
machine.succeed("mountpoint /boot");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "btrfs-only-root-subvolume";
|
||||
disko-config = ../example/btrfs-only-root-subvolume.nix;
|
||||
disko-config = ../../example/btrfs-only-root-subvolume.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("btrfs subvolume list /");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "btrfs-subvolumes";
|
||||
disko-config = ../example/btrfs-subvolumes.nix;
|
||||
disko-config = ../../example/btrfs-subvolumes.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test ! -e /test");
|
||||
machine.succeed("test -e /home/user");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "complex";
|
||||
disko-config = ../example/complex.nix;
|
||||
disko-config = ../../example/complex.nix;
|
||||
extraInstallerConfig.networking.hostId = "8425e349";
|
||||
extraSystemConfig = {
|
||||
networking.hostId = "8425e349";
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "f2fs";
|
||||
disko-config = ../example/f2fs.nix;
|
||||
disko-config = ../../example/f2fs.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("lsblk --fs >&2");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "gpt-bios-compat";
|
||||
disko-config = ../example/gpt-bios-compat.nix;
|
||||
disko-config = ../../example/gpt-bios-compat.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "gpt-name-with-whitespace";
|
||||
disko-config = ../example/gpt-name-with-whitespace.nix;
|
||||
disko-config = ../../example/gpt-name-with-whitespace.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("mountpoint '/name with spaces'");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "hybrid-mbr";
|
||||
disko-config = ../example/hybrid-mbr.nix;
|
||||
disko-config = ../../example/hybrid-mbr.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "hybrid-tmpfs-on-root";
|
||||
disko-config = ../example/hybrid-tmpfs-on-root.nix;
|
||||
disko-config = ../../example/hybrid-tmpfs-on-root.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("findmnt / --types tmpfs");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "hybrid";
|
||||
disko-config = ../example/hybrid.nix;
|
||||
disko-config = ../../example/hybrid.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "legacy-table-with-whitespace";
|
||||
disko-config = ../example/legacy-table-with-whitespace.nix;
|
||||
disko-config = ../../example/legacy-table-with-whitespace.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("mountpoint /name_with_spaces");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "legacy-table";
|
||||
disko-config = ../example/legacy-table.nix;
|
||||
disko-config = ../../example/legacy-table.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "long-device-name";
|
||||
disko-config = ../example/long-device-name.nix;
|
||||
disko-config = ../../example/long-device-name.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
@@ -5,7 +5,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-btrfs-raid";
|
||||
disko-config = ../example/luks-btrfs-raid.nix;
|
||||
disko-config = ../../example/luks-btrfs-raid.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||
machine.succeed("cryptsetup isLuks /dev/vdb1");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-btrfs-subvolumes";
|
||||
disko-config = ../example/luks-btrfs-subvolumes.nix;
|
||||
disko-config = ../../example/luks-btrfs-subvolumes.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||
machine.succeed("btrfs subvolume list / | grep -qs 'path nix$'");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-interactive-login";
|
||||
disko-config = ../example/luks-interactive-login.nix;
|
||||
disko-config = ../../example/luks-interactive-login.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-lvm";
|
||||
disko-config = ../example/luks-lvm.nix;
|
||||
disko-config = ../../example/luks-lvm.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||
machine.succeed("mountpoint /home");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-on-mdadm";
|
||||
disko-config = ../example/luks-on-mdadm.nix;
|
||||
disko-config = ../../example/luks-on-mdadm.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -b /dev/md/raid1");
|
||||
machine.succeed("mountpoint /");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "lvm-raid";
|
||||
disko-config = ../example/lvm-raid.nix;
|
||||
disko-config = ../../example/lvm-raid.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /home");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "lvm-sizes-sort";
|
||||
disko-config = ../example/lvm-sizes-sort.nix;
|
||||
disko-config = ../../example/lvm-sizes-sort.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /home");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "lvm-thin";
|
||||
disko-config = ../example/lvm-thin.nix;
|
||||
disko-config = ../../example/lvm-thin.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /home");
|
||||
'';
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "mdadm-raid0";
|
||||
disko-config = ../example/mdadm-raid0.nix;
|
||||
disko-config = ../../example/mdadm-raid0.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -b /dev/md/raid0");
|
||||
machine.succeed("mountpoint /");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "mdadm";
|
||||
disko-config = ../example/mdadm.nix;
|
||||
disko-config = ../../example/mdadm.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -b /dev/md/raid1");
|
||||
machine.succeed("mountpoint /");
|
||||
@@ -5,7 +5,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "multi-device-no-deps";
|
||||
disko-config = ../example/multi-device-no-deps.nix;
|
||||
disko-config = ../../example/multi-device-no-deps.nix;
|
||||
testBoot = false;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /mnt/a");
|
||||
@@ -5,7 +5,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "negative-size";
|
||||
disko-config = ../example/negative-size.nix;
|
||||
disko-config = ../../example/negative-size.nix;
|
||||
testBoot = false;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /mnt");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "non-root-zfs";
|
||||
disko-config = ../example/non-root-zfs.nix;
|
||||
disko-config = ../../example/non-root-zfs.nix;
|
||||
extraInstallerConfig.networking.hostId = "8425e349";
|
||||
extraSystemConfig.networking.hostId = "8425e349";
|
||||
postDisko = ''
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "simple-efi";
|
||||
disko-config = ../example/simple-efi.nix;
|
||||
disko-config = ../../example/simple-efi.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
@@ -1,5 +1,5 @@
|
||||
{ pkgs ? import <nixpkgs> { }, ... }:
|
||||
(pkgs.nixos [
|
||||
../example/stand-alone/configuration.nix
|
||||
../../example/stand-alone/configuration.nix
|
||||
{ documentation.enable = false; }
|
||||
]).config.system.build.toplevel
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "swap";
|
||||
disko-config = ../example/swap.nix;
|
||||
disko-config = ../../example/swap.nix;
|
||||
extraTestScript = ''
|
||||
import json
|
||||
machine.succeed("mountpoint /");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "tmpfs";
|
||||
disko-config = ../example/tmpfs.nix;
|
||||
disko-config = ../../example/tmpfs.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("mountpoint /tmp");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "with-lib";
|
||||
disko-config = ../example/with-lib.nix;
|
||||
disko-config = ../../example/with-lib.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("mountpoint /");
|
||||
'';
|
||||
@@ -6,7 +6,7 @@ diskoLib.testLib.makeDiskoTest {
|
||||
name = "zfs-over-legacy";
|
||||
extraInstallerConfig.networking.hostId = "8425e349";
|
||||
extraSystemConfig.networking.hostId = "8425e349";
|
||||
disko-config = ../example/zfs-over-legacy.nix;
|
||||
disko-config = ../../example/zfs-over-legacy.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -e /zfs_fs");
|
||||
machine.succeed("mountpoint /zfs_fs");
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "zfs-with-vdevs";
|
||||
disko-config = ../example/zfs-with-vdevs.nix;
|
||||
disko-config = ../../example/zfs-with-vdevs.nix;
|
||||
extraInstallerConfig.networking.hostId = "8425e349";
|
||||
extraSystemConfig = {
|
||||
networking.hostId = "8425e349";
|
||||
@@ -4,7 +4,7 @@
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "zfs";
|
||||
disko-config = ../example/zfs.nix;
|
||||
disko-config = ../../example/zfs.nix;
|
||||
extraInstallerConfig.networking.hostId = "8425e349";
|
||||
extraSystemConfig = {
|
||||
networking.hostId = "8425e349";
|
||||
Reference in new issue
Block a user