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 { };
hound = handleTest ./hound.nix { };
hub = handleTest ./git/hub.nix { };
hydra = handleTest ./hydra { };
hydra = runTest ./hydra;
i3wm = handleTest ./i3wm.nix { };
icingaweb2 = runTest ./icingaweb2.nix;
ifm = handleTest ./ifm.nix { };

View file

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

View file

@ -1,25 +1,9 @@
{
system ? builtins.currentSystem,
config ? { },
pkgs ? import ../../.. { inherit system config; },
}:
with import ../../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
{ pkgs, ... }:
let
inherit (import ./common.nix { inherit system; }) baseConfig;
hydraPkgs = {
inherit (pkgs) hydra;
};
makeHydraTest =
with pkgs.lib;
name: package:
makeTest {
name = "hydra-${name}";
inherit (import ./common.nix) baseConfig;
in
{
name = "hydra";
meta = with pkgs.lib.maintainers; {
maintainers = [ lewo ];
};
@ -28,7 +12,6 @@ let
{ pkgs, lib, ... }:
{
imports = [ baseConfig ];
services.hydra = { inherit package; };
};
testScript = ''
@ -58,8 +41,4 @@ let
'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 = {
inherit nix perlDeps;
tests.basic = nixosTests.hydra.hydra;
tests = { inherit (nixosTests) hydra; };
updateScript = unstableGitUpdater { };
};