at 23.11-pre 1.7 kB view raw
1{ system ? builtins.currentSystem 2, config ? { } 3, pkgs ? import ../../.. { inherit system config; } 4}: 5 6with import ../../lib/testing-python.nix { inherit system pkgs; }; 7with pkgs.lib; 8 9let 10 11 inherit (import ./common.nix { inherit system; }) baseConfig; 12 13 hydraPkgs = { 14 inherit (pkgs) hydra_unstable; 15 }; 16 17 makeHydraTest = with pkgs.lib; name: package: makeTest { 18 name = "hydra-${name}"; 19 meta = with pkgs.lib.maintainers; { 20 maintainers = [ lewo ma27 ]; 21 }; 22 23 nodes.machine = { pkgs, lib, ... }: { 24 imports = [ baseConfig ]; 25 services.hydra = { inherit package; }; 26 }; 27 28 testScript = '' 29 # let the system boot up 30 machine.wait_for_unit("multi-user.target") 31 # test whether the database is running 32 machine.wait_for_unit("postgresql.service") 33 # test whether the actual hydra daemons are running 34 machine.wait_for_unit("hydra-init.service") 35 machine.require_unit_state("hydra-queue-runner.service") 36 machine.require_unit_state("hydra-evaluator.service") 37 machine.require_unit_state("hydra-notify.service") 38 39 machine.succeed("hydra-create-user admin --role admin --password admin") 40 41 # create a project with a trivial job 42 machine.wait_for_open_port(3000) 43 44 # make sure the build as been successfully built 45 machine.succeed("create-trivial-project.sh") 46 47 machine.wait_until_succeeds( 48 'curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq' 49 ) 50 51 machine.wait_until_succeeds( 52 'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"' 53 ) 54 ''; 55 }; 56 57in 58 59mapAttrs makeHydraTest hydraPkgs