nixosTests.github-runner: migrate to runTest

Part of #386873

Changed files
+39 -41
nixos
+1 -1
nixos/tests/all-tests.nix
···
ghostunnel = handleTest ./ghostunnel.nix { };
gitdaemon = handleTest ./gitdaemon.nix { };
gitea = handleTest ./gitea.nix { giteaPackage = pkgs.gitea; };
-
github-runner = handleTest ./github-runner.nix { };
+
github-runner = runTest ./github-runner.nix;
gitlab = runTest ./gitlab.nix;
gitolite = handleTest ./gitolite.nix { };
gitolite-fcgiwrap = handleTest ./gitolite-fcgiwrap.nix { };
+38 -40
nixos/tests/github-runner.nix
···
-
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";
-
};
+
{ 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";
+
};
-
services.github-runners.test-disabled = {
-
enable = false;
-
url = "https://github.com/yaxitech";
-
tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
-
};
+
services.github-runners.test-disabled = {
+
enable = false;
+
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" ];
+
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()
+
testScript = ''
+
start_all()
-
machine.wait_for_unit("dummy-github-com")
+
machine.wait_for_unit("dummy-github-com")
-
try:
-
machine.wait_for_unit("github-runner-test")
-
except Exception:
-
pass
+
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"
+
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")
+
machine.wait_until_succeeds("test -f /tmp/registration-connect")
-
machine.fail("systemctl list-unit-files | grep test-disabled")
-
'';
-
}
-
)
+
machine.fail("systemctl list-unit-files | grep test-disabled")
+
'';
+
}