diff options
author | Tristan Daniël Maat <tm@tlater.net> | 2023-10-07 01:21:21 +0200 |
---|---|---|
committer | Tristan Daniël Maat <tm@tlater.net> | 2023-10-07 21:53:02 +0200 |
commit | b59e5a34e782478445b6ea690fd546c8624ed705 (patch) | |
tree | 96230718d8142ed250e09659919f8c7cc44d2f13 /nixos/tests/gitea.nix | |
parent | 4d675aec00a1883f872df2a15412d15f2685d758 (diff) |
nixos/gitea: Add option to supply the metrics token via file
Diffstat (limited to 'nixos/tests/gitea.nix')
-rw-r--r-- | nixos/tests/gitea.nix | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/tests/gitea.nix b/nixos/tests/gitea.nix index b747659de8298..f574b59be5452 100644 --- a/nixos/tests/gitea.nix +++ b/nixos/tests/gitea.nix @@ -35,9 +35,11 @@ let enable = true; database = { inherit type; }; package = giteaPackage; + metricsTokenFile = (pkgs.writeText "metrics_secret" "fakesecret").outPath; settings.service.DISABLE_REGISTRATION = true; settings."repository.signing".SIGNING_KEY = signingPrivateKeyId; settings.actions.ENABLED = true; + settings.metrics.ENABLED = true; }; environment.systemPackages = [ giteaPackage pkgs.gnupg pkgs.jq ]; services.openssh.enable = true; @@ -143,6 +145,12 @@ let + '-H "Accept: application/json" | jq length)" = "1"' ) + with subtest("Testing metrics endpoint"): + server.succeed('curl ' + + '-H "Authorization: Bearer fakesecret" ' + + 'http://localhost:3000/metrics ' + + '| grep gitea_accesses') + with subtest("Testing runner registration"): server.succeed( "su -l gitea -c 'GITEA_WORK_DIR=/var/lib/gitea gitea actions generate-runner-token' | sed 's/^/TOKEN=/' | tee /var/lib/gitea/runner_token" |