diff options
author | Vincent Haupert <vincent@yaxi.tech> | 2023-02-26 13:50:49 +0100 |
---|---|---|
committer | Vincent Haupert <vincent@yaxi.tech> | 2023-02-26 15:39:19 +0100 |
commit | e8df83d417a65f84914ee27da98b870c0e7d143c (patch) | |
tree | b42fa7fb80454282004eaf483d334efed58e833e /nixos/tests/github-runner.nix | |
parent | 137db83090cf371369a48111b3bd1c888288f19e (diff) | |
download | nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar.gz nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar.bz2 nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar.lz nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar.xz nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.tar.zst nixpkgs-e8df83d417a65f84914ee27da98b870c0e7d143c.zip |
nixos/tests/github-runner: init
Diffstat (limited to 'nixos/tests/github-runner.nix')
-rw-r--r-- | nixos/tests/github-runner.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/tests/github-runner.nix b/nixos/tests/github-runner.nix new file mode 100644 index 00000000000..033365d6925 --- /dev/null +++ b/nixos/tests/github-runner.nix @@ -0,0 +1,37 @@ +import ./make-test-python.nix ({ pkgs, ... }: +{ + name = "github-runner"; + meta = with pkgs.lib.maintainers; { + maintainers = [ veehaitch ]; + }; + nodes.machine = { pkgs, ... }: { + services.github-runners.test = { + enable = true; + url = "https://github.com/yaxitech"; + tokenFile = builtins.toFile "github-runner.token" "not-so-secret"; + }; + + systemd.services.dummy-github-com = { + wantedBy = [ "multi-user.target" ]; + before = [ "github-runner-test.service" ]; + script = "${pkgs.netcat}/bin/nc -Fl 443 | true && touch /tmp/registration-connect"; + }; + networking.hosts."127.0.0.1" = [ "api.github.com" ]; + }; + + testScript = '' + start_all() + + machine.wait_for_unit("dummy-github-com") + + try: + machine.wait_for_unit("github-runner-test") + except Exception: + pass + + out = machine.succeed("journalctl -u github-runner-test") + assert "Self-hosted runner registration" in out, "did not read runner registration header" + + machine.wait_until_succeeds("test -f /tmp/registration-connect") + ''; +}) |