python312Packages.dissect-extfs: 3.11 -> 3.12
[NixPkgs.git] / nixos / tests / github-runner.nix
blobf3e4b70fa5d3df0105dbec3dbfee302517d7d333
1 import ./make-test-python.nix ({ pkgs, ... }:
3   name = "github-runner";
4   meta = with pkgs.lib.maintainers; {
5     maintainers = [ veehaitch ];
6   };
7   nodes.machine = { pkgs, ... }: {
8     services.github-runners.test = {
9       enable = true;
10       url = "https://github.com/yaxitech";
11       tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
12     };
14     services.github-runners.test-disabled = {
15       enable = false;
16       url = "https://github.com/yaxitech";
17       tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
18     };
20     systemd.services.dummy-github-com = {
21       wantedBy = [ "multi-user.target" ];
22       before = [ "github-runner-test.service" ];
23       script = "${pkgs.netcat}/bin/nc -Fl 443 | true && touch /tmp/registration-connect";
24     };
25     networking.hosts."127.0.0.1" = [ "api.github.com" ];
26   };
28   testScript = ''
29     start_all()
31     machine.wait_for_unit("dummy-github-com")
33     try:
34       machine.wait_for_unit("github-runner-test")
35     except Exception:
36       pass
38     out = machine.succeed("journalctl -u github-runner-test")
39     assert "Self-hosted runner registration" in out, "did not read runner registration header"
41     machine.wait_until_succeeds("test -f /tmp/registration-connect")
43     machine.fail("systemctl list-unit-files | grep test-disabled")
44   '';