nixpkgs/nixos/tests/hydra/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

66 lines
1.8 KiB
Nix

{
system ? builtins.currentSystem,
config ? { },
pkgs ? import ../../.. { inherit system config; },
}:
with import ../../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
let
inherit (import ./common.nix { inherit system; }) baseConfig;
hydraPkgs = {
inherit (pkgs) hydra;
};
makeHydraTest =
with pkgs.lib;
name: package:
makeTest {
name = "hydra-${name}";
meta = with pkgs.lib.maintainers; {
maintainers = [ lewo ];
};
nodes.machine =
{ pkgs, lib, ... }:
{
imports = [ baseConfig ];
services.hydra = { inherit package; };
};
testScript = ''
# let the system boot up
machine.wait_for_unit("multi-user.target")
# test whether the database is running
machine.wait_for_unit("postgresql.service")
# test whether the actual hydra daemons are running
machine.wait_for_unit("hydra-init.service")
machine.require_unit_state("hydra-queue-runner.service")
machine.require_unit_state("hydra-evaluator.service")
machine.require_unit_state("hydra-notify.service")
machine.succeed("hydra-create-user admin --role admin --password admin")
# create a project with a trivial job
machine.wait_for_open_port(3000)
# make sure the build as been successfully built
machine.succeed("create-trivial-project.sh")
machine.wait_until_succeeds(
'curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'
)
machine.wait_until_succeeds(
'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"'
)
'';
};
in
mapAttrs makeHydraTest hydraPkgs