summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-10-13 23:42:28 +0200
committerAustin Seipp <aseipp@pobox.com>2018-10-14 20:12:07 -0500
commit01d1f776818176a9cac7d7c9d3a319694fea4f1a (patch)
tree1b864bb78c721da5f19586a1f9c4dcfa07ccb563 /nixos/tests
parent9ab8920235d2c78b4d0001a920cb9c69148de2a7 (diff)
downloadnixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar.gz
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar.bz2
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar.lz
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar.xz
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.tar.zst
nixlib-01d1f776818176a9cac7d7c9d3a319694fea4f1a.zip
tests/prometheus-exporters: add new Tor exporter
This new exporter was added in #48307.
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/prometheus-exporters.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index 2f2c06dcb7d6..5d1e004c5dd1 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -243,6 +243,25 @@ let
       '';
     };
 
+    tor = {
+      exporterConfig = {
+        enable = true;
+      };
+      metricProvider = {
+        # Note: this does not connect the test environment to the Tor network.
+        # Client, relay, bridge or exit connectivity are disabled by default.
+        services.tor.enable = true;
+        services.tor.controlPort = 9051;
+      };
+      exporterTest = ''
+        waitForUnit("tor.service");
+        waitForOpenPort(9051);
+        waitForUnit("prometheus-tor-exporter.service");
+        waitForOpenPort(9130);
+        succeed("curl -sSf localhost:9130/metrics | grep -q 'tor_version{.\\+} 1'");
+      '';
+    };
+
     varnish = {
       exporterConfig = {
         enable = true;