at 23.11-beta 1.1 kB view raw
1import ./make-test-python.nix ({ pkgs, ... }: 2{ 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 }; 13 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 }; 21 22 testScript = '' 23 start_all() 24 25 machine.wait_for_unit("dummy-github-com") 26 27 try: 28 machine.wait_for_unit("github-runner-test") 29 except Exception: 30 pass 31 32 out = machine.succeed("journalctl -u github-runner-test") 33 assert "Self-hosted runner registration" in out, "did not read runner registration header" 34 35 machine.wait_until_succeeds("test -f /tmp/registration-connect") 36 ''; 37})