mirror of
https://github.com/nix-community/disko.git
synced 2024-09-19 02:27:27 +03:00
move tests/lib.nix into diskoLib.testLib
This commit is contained in:
parent
cd38be93db
commit
056637d3c9
@ -1,10 +1,16 @@
|
||||
{ lib, rootMountPoint }:
|
||||
{ lib ? import <nixpkgs/lib>
|
||||
, rootMountPoint ? "/mnt"
|
||||
, makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
||||
, eval-config ? import <nixpkgs/nixos/lib/eval-config.nix>
|
||||
}:
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let
|
||||
|
||||
diskoLib = {
|
||||
|
||||
testLib = import ./tests.nix { inherit lib makeTest eval-config; };
|
||||
# like lib.types.oneOf but instead of a list takes an attrset
|
||||
# uses the field "type" to find the correct type in the attrset
|
||||
subType = { types, extraArgs ? { parent = { type = "rootNode"; name = "root"; }; } }: lib.mkOptionType rec {
|
||||
|
@ -1,12 +1,10 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, lib ? pkgs.lib
|
||||
, makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
||||
, eval-config ? import <nixpkgs/nixos/lib/eval-config.nix>
|
||||
{ lib
|
||||
, makeTest
|
||||
, eval-config
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
diskoLib = import ../lib { inherit pkgs lib; };
|
||||
testlib = {
|
||||
# this takes a disko toplevel config and changes the disk devices so we can run them inside the qemu test runner
|
||||
# basically changes all the disk.*.devices to something like /dev/vda or /dev/vdb etc.
|
||||
@ -34,6 +32,7 @@ let
|
||||
makeDiskoTest =
|
||||
{ name
|
||||
, disko-config
|
||||
, pkgs ? import <nixpkgs> { }
|
||||
, extraTestScript ? ""
|
||||
, bootCommands ? ""
|
||||
, extraConfig ? { }
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "bcachefs";
|
||||
disko-config = ../example/bcachefs.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "boot-raid1";
|
||||
disko-config = ../example/boot-raid1.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "btrfs-subvolumes";
|
||||
disko-config = ../example/btrfs-subvolumes.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "cli";
|
||||
disko-config = ../example/complex.nix;
|
||||
extraConfig = {
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "complex";
|
||||
disko-config = ../example/complex.nix;
|
||||
extraConfig = {
|
||||
|
@ -4,7 +4,8 @@
|
||||
}:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest eval-config; }).makeDiskoTest;
|
||||
diskoLib = import ../lib { inherit lib makeTest eval-config; };
|
||||
makeDiskoTest = diskoLib.testLib.makeDiskoTest;
|
||||
|
||||
allTestFilenames =
|
||||
builtins.map (lib.removeSuffix ".nix") (
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "gpt-bios-compat";
|
||||
disko-config = ../example/gpt-bios-compat.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "hybrid-tmpfs-on-root";
|
||||
disko-config = ../example/hybrid-tmpfs-on-root.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "hybrid";
|
||||
disko-config = ../example/hybrid.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "luks-lvm";
|
||||
disko-config = ../example/luks-lvm.nix;
|
||||
extraConfig.boot.initrd.luks.devices.crypted.preLVM = false;
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "lvm-raid";
|
||||
disko-config = ../example/lvm-raid.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "lvm-sizes-sort";
|
||||
disko-config = ../example/lvm-sizes-sort.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "mdadm";
|
||||
disko-config = ../example/mdadm.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "module";
|
||||
disko-config = ../example/complex.nix;
|
||||
extraConfig = {
|
||||
|
@ -1,8 +1,9 @@
|
||||
# this is a regression test for https://github.com/nix-community/disko/issues/52
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "multi-device-no-deps";
|
||||
disko-config = ../example/multi-device-no-deps.nix;
|
||||
testBoot = false;
|
||||
|
@ -1,8 +1,9 @@
|
||||
# this is a regression test for https://github.com/nix-community/disko/issues/52
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "negative-size";
|
||||
disko-config = ../example/negative-size.nix;
|
||||
testBoot = false;
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "simple-efi";
|
||||
disko-config = ../example/simple-efi.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "swap";
|
||||
disko-config = ../example/swap.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "tmpfs";
|
||||
disko-config = ../example/tmpfs.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "with-lib";
|
||||
disko-config = ../example/with-lib.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "zfs-over-legacy";
|
||||
disko-config = ../example/zfs-over-legacy.nix;
|
||||
extraTestScript = ''
|
||||
|
@ -1,7 +1,8 @@
|
||||
{ pkgs ? (import <nixpkgs> { })
|
||||
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
|
||||
, makeDiskoTest ? (pkgs.callPackage ../lib { }).testLib.makeDiskoTest
|
||||
}:
|
||||
makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "zfs";
|
||||
disko-config = ../example/zfs.nix;
|
||||
extraConfig = {
|
||||
|
Loading…
Reference in New Issue
Block a user