From 4851b2be0184a0aed976fcced4c1e7b6d7eae82c Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Wed, 31 Jan 2024 20:13:32 +0100 Subject: [PATCH] nixos/tests/prometheus-exporters: add exportarr-sonarr test --- nixos/tests/prometheus-exporters.nix | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 0bb9b6fcc8d5..e30fb873525b 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -257,6 +257,46 @@ let ''; }; + exportarr-sonarr = let apikey = "eccff6a992bc2e4b88e46d064b26bb4e"; in { + nodeName = "exportarr_sonarr"; + exporterConfig = { + enable = true; + url = "http://127.0.0.1:8989"; + apiKeyFile = pkgs.writeText "dummy-api-key" apikey; + }; + metricProvider = { + services.sonarr.enable = true; + systemd.services.sonarr.serviceConfig.ExecStartPre = + let + sonarr_config = pkgs.writeText "config.xml" '' + + info + False + 8989 + 9898 + + * + ${apikey} + None + BuiltIn + main + Sonarr + + ''; + in + [ + ''${pkgs.coreutils}/bin/install -D -m 777 ${sonarr_config} -T /var/lib/sonarr/.config/NzbDrone/config.xml'' + ]; + }; + exporterTest = '' + wait_for_unit("sonarr.service") + wait_for_open_port(8989) + wait_for_unit("prometheus-exportarr-sonarr-exporter.service") + wait_for_open_port(9708) + succeed("curl -sSf http://localhost:9708/metrics | grep sonarr_series_total") + ''; + }; + fastly = { exporterConfig = { enable = true;