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