vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / github-runner.nix
blob033365d6925cf10e2fce0ce2d0bf98d3f7aa9a91
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     systemd.services.dummy-github-com = {
15       wantedBy = [ "multi-user.target" ];
16       before = [ "github-runner-test.service" ];
17       script = "${pkgs.netcat}/bin/nc -Fl 443 | true && touch /tmp/registration-connect";
18     };
19     networking.hosts."127.0.0.1" = [ "api.github.com" ];
20   };
22   testScript = ''
23     start_all()
25     machine.wait_for_unit("dummy-github-com")
27     try:
28       machine.wait_for_unit("github-runner-test")
29     except Exception:
30       pass
32     out = machine.succeed("journalctl -u github-runner-test")
33     assert "Self-hosted runner registration" in out, "did not read runner registration header"
35     machine.wait_until_succeeds("test -f /tmp/registration-connect")
36   '';