nixos/hydra: switch to runTest, refactor

This commit is contained in:
zowoq 2025-02-22 09:18:51 +10:00
parent ab2a3d7d68
commit b16f158e1b
4 changed files with 41 additions and 63 deletions

View file

@ -611,7 +611,7 @@ in
hostname = handleTest ./hostname.nix { }; hostname = handleTest ./hostname.nix { };
hound = handleTest ./hound.nix { }; hound = handleTest ./hound.nix { };
hub = handleTest ./git/hub.nix { }; hub = handleTest ./git/hub.nix { };
hydra = handleTest ./hydra { }; hydra = runTest ./hydra;
i3wm = handleTest ./i3wm.nix { }; i3wm = handleTest ./i3wm.nix { };
icingaweb2 = runTest ./icingaweb2.nix; icingaweb2 = runTest ./icingaweb2.nix;
ifm = handleTest ./ifm.nix { }; ifm = handleTest ./ifm.nix { };

View file

@ -1,4 +1,3 @@
{ system, ... }:
{ {
baseConfig = baseConfig =
{ pkgs, ... }: { pkgs, ... }:
@ -6,7 +5,7 @@
trivialJob = pkgs.writeTextDir "trivial.nix" '' trivialJob = pkgs.writeTextDir "trivial.nix" ''
{ trivial = builtins.derivation { { trivial = builtins.derivation {
name = "trivial"; name = "trivial";
system = "${system}"; system = "${pkgs.stdenv.hostPlatform.system}";
builder = "/bin/sh"; builder = "/bin/sh";
allowSubstitutes = false; allowSubstitutes = false;
preferLocalBuild = true; preferLocalBuild = true;

View file

@ -1,25 +1,9 @@
{ { pkgs, ... }:
system ? builtins.currentSystem,
config ? { },
pkgs ? import ../../.. { inherit system config; },
}:
with import ../../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
let let
inherit (import ./common.nix) baseConfig;
inherit (import ./common.nix { inherit system; }) baseConfig; in
{
hydraPkgs = { name = "hydra";
inherit (pkgs) hydra;
};
makeHydraTest =
with pkgs.lib;
name: package:
makeTest {
name = "hydra-${name}";
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ lewo ]; maintainers = [ lewo ];
}; };
@ -28,7 +12,6 @@ let
{ pkgs, lib, ... }: { pkgs, lib, ... }:
{ {
imports = [ baseConfig ]; imports = [ baseConfig ];
services.hydra = { inherit package; };
}; };
testScript = '' testScript = ''
@ -58,8 +41,4 @@ let
'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"' 'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"'
) )
''; '';
}; }
in
mapAttrs makeHydraTest hydraPkgs

View file

@ -265,7 +265,7 @@ stdenv.mkDerivation (finalAttrs: {
passthru = { passthru = {
inherit nix perlDeps; inherit nix perlDeps;
tests.basic = nixosTests.hydra.hydra; tests = { inherit (nixosTests) hydra; };
updateScript = unstableGitUpdater { }; updateScript = unstableGitUpdater { };
}; };