vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / sourcehut / builds.nix
blobf1f928ecc3d0a70d35d7f35ffec4e3e513d2c3ac
1 import ../make-test-python.nix ({ pkgs, lib, ... }:
2 let
3   domain = "sourcehut.localdomain";
4 in
6   name = "sourcehut";
8   meta.maintainers = with pkgs.lib.maintainers; [ tomberek nessdoor ];
10   nodes.machine = { config, pkgs, nodes, ... }: {
11     imports = [
12       ./nodes/common.nix
13     ];
15     networking.domain = domain;
16     networking.extraHosts = ''
17       ${config.networking.primaryIPAddress} builds.${domain}
18       ${config.networking.primaryIPAddress} meta.${domain}
19     '';
21     services.sourcehut = {
22       builds = {
23         enable = true;
24         # FIXME: see why it does not seem to activate fully.
25         #enableWorker = true;
26         images = { };
27       };
29       settings."builds.sr.ht" = {
30         oauth-client-secret = pkgs.writeText "buildsrht-oauth-client-secret" "2260e9c4d9b8dcedcef642860e0504bc";
31         oauth-client-id = "299db9f9c2013170";
32       };
33     };
34   };
36   testScript = ''
37     start_all()
38     machine.wait_for_unit("multi-user.target")
40     with subtest("Check whether meta comes up"):
41          machine.wait_for_unit("metasrht-api.service")
42          machine.wait_for_unit("metasrht.service")
43          machine.wait_for_unit("metasrht-webhooks.service")
44          machine.wait_for_open_port(5000)
45          machine.succeed("curl -sL http://localhost:5000 | grep meta.${domain}")
46          machine.succeed("curl -sL http://meta.${domain} | grep meta.${domain}")
48     with subtest("Check whether builds comes up"):
49          machine.wait_for_unit("buildsrht.service")
50          machine.wait_for_open_port(5002)
51          machine.succeed("curl -sL http://localhost:5002 | grep builds.${domain}")
52          #machine.wait_for_unit("buildsrht-worker.service")
53   '';