diff options
author | h7x4 <h7x4@nani.wtf> | 2024-02-01 20:05:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 20:05:11 +0100 |
commit | 932344b54a276a1a74cad3bf1a3f4715ad85ef64 (patch) | |
tree | 7757081c5cd4245e9ac9266060600fe83ca725a3 /nixos/tests | |
parent | d070e3c00b929974dae80bc65936d690f5f14fe5 (diff) | |
parent | da91e4d75b1c35e3a712887b20d4c9984649ff88 (diff) |
Merge pull request #270475 from MinerSebas/prometheus-restic-exporter
prometheus-restic-exporter: init at 1.4.0
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/prometheus-exporters.nix | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 0f8e355b2f4c6..7e74f27174ec6 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -1177,6 +1177,39 @@ let ''; }; + restic = + let + repository = "rest:http://127.0.0.1:8000"; + passwordFile = pkgs.writeText "restic-test-password" "test-password"; + in + { + exporterConfig = { + enable = true; + inherit repository passwordFile; + }; + metricProvider = { + services.restic.server = { + enable = true; + extraFlags = [ "--no-auth" ]; + }; + environment.systemPackages = [ pkgs.restic ]; + }; + exporterTest = '' + # prometheus-restic-exporter.service fails without initialised repository + systemctl("stop prometheus-restic-exporter.service") + + # Initialise the repository + wait_for_unit("restic-rest-server.service") + wait_for_open_port(8000) + succeed("restic init --repo ${repository} --password-file ${passwordFile}") + + systemctl("start prometheus-restic-exporter.service") + wait_for_unit("prometheus-restic-exporter.service") + wait_for_open_port(9753) + wait_until_succeeds("curl -sSf localhost:9753/metrics | grep 'restic_check_success 1.0'") + ''; + }; + rspamd = { exporterConfig = { enable = true; @@ -1684,7 +1717,12 @@ mapAttrs testScript = '' ${nodeName}.start() ${concatStringsSep "\n" (map (line: - if (builtins.substring 0 1 line == " " || builtins.substring 0 1 line == ")") + if builtins.any (b: b) [ + (builtins.match "^[[:space:]]*$" line != null) + (builtins.substring 0 1 line == "#") + (builtins.substring 0 1 line == " ") + (builtins.substring 0 1 line == ")") + ] then line else "${nodeName}.${line}" ) (splitString "\n" (removeSuffix "\n" testConfig.exporterTest)))} |