nixos/tests/hydra: port to python

This commit is contained in:
Maximilian Bosch 2019-12-22 14:36:11 +01:00
parent ba5d7efe43
commit 7675c0b2a9
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E

View File

@ -34,7 +34,7 @@ let
};
tests = pkgs.lib.flip pkgs.lib.mapAttrs hydraPkgs (name: nix:
callTest (import ../make-test.nix ({ pkgs, lib, ... }:
callTest (import ../make-test-python.nix ({ pkgs, lib, ... }:
{
name = "hydra-with-${name}";
meta = with pkgs.stdenv.lib.maintainers; {
@ -73,26 +73,30 @@ let
testScript = ''
# let the system boot up
$machine->waitForUnit("multi-user.target");
machine.wait_for_unit("multi-user.target")
# test whether the database is running
$machine->waitForUnit("postgresql.service");
machine.wait_for_unit("postgresql.service")
# test whether the actual hydra daemons are running
$machine->waitForUnit("hydra-init.service");
$machine->requireActiveUnit("hydra-queue-runner.service");
$machine->requireActiveUnit("hydra-evaluator.service");
$machine->requireActiveUnit("hydra-notify.service");
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");
machine.succeed("hydra-create-user admin --role admin --password admin")
# create a project with a trivial job
$machine->waitForOpenPort(3000);
machine.wait_for_open_port(3000)
# make sure the build as been successfully built
$machine->succeed("create-trivial-project.sh");
machine.succeed("create-trivial-project.sh")
$machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq');
machine.wait_until_succeeds(
'curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'
)
$machine->waitUntilSucceeds('journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"');
machine.wait_until_succeeds(
'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"'
)
'';
})));