From 7675c0b2a98f60f8ac85208af9a716939ce29cd4 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 22 Dec 2019 14:36:11 +0100 Subject: [PATCH] nixos/tests/hydra: port to python --- nixos/tests/hydra/default.nix | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/nixos/tests/hydra/default.nix b/nixos/tests/hydra/default.nix index 6ca05a2c7797..37e14cb19ccc 100644 --- a/nixos/tests/hydra/default.nix +++ b/nixos/tests/hydra/default.nix @@ -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"' + ) ''; })));