about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2019-04-09 14:14:18 +0200
committerGitHub <noreply@github.com>2019-04-09 14:14:18 +0200
commit2f2e2971d6ccdd42165a23905ba9dc2aa11b3554 (patch)
tree648af6bd10441c9f53b9e4f62fbebb6bb375aec7 /nixos/tests
parent14105fd257cf17d0240185014bc1c13b174dc83d (diff)
parentb423b73adc8cb0d8ea815ad46de20fdb6fc266b5 (diff)
downloadnixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar.gz
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar.bz2
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar.lz
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar.xz
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.tar.zst
nixlib-2f2e2971d6ccdd42165a23905ba9dc2aa11b3554.zip
Merge pull request #58255 from jbgi/prometheus2
Add Prometheus 2 service in parallel with 1.x version (continuation)
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/prometheus-2.nix34
2 files changed, 35 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 66a877e8bae7..14d855f44dc7 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -194,6 +194,7 @@ in
   predictable-interface-names = handleTest ./predictable-interface-names.nix {};
   printing = handleTest ./printing.nix {};
   prometheus = handleTest ./prometheus.nix {};
+  prometheus2 = handleTest ./prometheus-2.nix {};
   prometheus-exporters = handleTest ./prometheus-exporters.nix {};
   prosody = handleTest ./prosody.nix {};
   proxy = handleTest ./proxy.nix {};
diff --git a/nixos/tests/prometheus-2.nix b/nixos/tests/prometheus-2.nix
new file mode 100644
index 000000000000..5a4d8668cb87
--- /dev/null
+++ b/nixos/tests/prometheus-2.nix
@@ -0,0 +1,34 @@
+import ./make-test.nix {
+  name = "prometheus-2";
+
+  nodes = {
+    one = { pkgs, ... }: {
+      services.prometheus2 = {
+        enable = true;
+        scrapeConfigs = [{
+          job_name = "prometheus";
+          static_configs = [{
+            targets = [ "127.0.0.1:9090" ];
+            labels = { instance = "localhost"; };
+          }];
+        }];
+        rules = [
+          ''
+            groups:
+              - name: test
+                rules:
+                  - record: testrule
+                    expr: count(up{job="prometheus"})
+          ''
+        ];
+      };
+    };
+  };
+
+  testScript = ''
+    startAll;
+    $one->waitForUnit("prometheus2.service");
+    $one->waitForOpenPort(9090);
+    $one->succeed("curl -s http://127.0.0.1:9090/metrics");
+  '';
+}