nixos/tests: add nixos-rebuild-install-bootloader-ng

This commit is contained in:
Thiago Kenji Okada 2024-12-05 22:52:38 +00:00
parent c27b1c401a
commit 81148841b9
3 changed files with 8 additions and 3 deletions

View file

@ -711,6 +711,7 @@ in {
nixops = handleTest ./nixops/default.nix {}; nixops = handleTest ./nixops/default.nix {};
nixos-generate-config = handleTest ./nixos-generate-config.nix {}; nixos-generate-config = handleTest ./nixos-generate-config.nix {};
nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {}; nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {};
nixos-rebuild-install-bootloader-ng = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix { withNg = true; };
nixos-rebuild-specialisations = runTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix; nixos-rebuild-specialisations = runTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix;
nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix; nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix;
nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; }; nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };

View file

@ -1,4 +1,4 @@
import ./make-test-python.nix ({ pkgs, ... }: { import ./make-test-python.nix ({ pkgs, lib, withNg ? false, ... }: {
name = "nixos-rebuild-install-bootloader"; name = "nixos-rebuild-install-bootloader";
nodes = { nodes = {
@ -15,6 +15,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
}; };
system.includeBuildDependencies = true; system.includeBuildDependencies = true;
system.rebuild.enableNg = withNg;
virtualisation = { virtualisation = {
cores = 2; cores = 2;
@ -27,7 +28,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
testScript = testScript =
let let
configFile = pkgs.writeText "configuration.nix" '' configFile = pkgs.writeText "configuration.nix" /* nix */ ''
{ lib, pkgs, ... }: { { lib, pkgs, ... }: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -40,12 +41,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
forceInstall = true; forceInstall = true;
}; };
system.rebuild.enableNg = ${lib.boolToString withNg};
documentation.enable = false; documentation.enable = false;
} }
''; '';
in in
'' /* python */ ''
machine.start() machine.start()
machine.succeed("udevadm settle") machine.succeed("udevadm settle")
machine.wait_for_unit("multi-user.target") machine.wait_for_unit("multi-user.target")

View file

@ -4,6 +4,7 @@
installShellFiles, installShellFiles,
mkShell, mkShell,
nix, nix,
nixosTests,
python3, python3,
python3Packages, python3Packages,
runCommand, runCommand,
@ -94,6 +95,7 @@ python3Packages.buildPythonApplication rec {
}; };
tests = { tests = {
inherit (nixosTests) nixos-rebuild-install-bootloader-ng;
repl = callPackage ./tests/repl.nix { }; repl = callPackage ./tests/repl.nix { };
# NOTE: this is a passthru test rather than a build-time test because we # NOTE: this is a passthru test rather than a build-time test because we
# want to keep the build closures small # want to keep the build closures small