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