about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorAlberto Berti <alberto@metapensiero.it>2019-02-21 16:32:46 +0100
committerJean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>2019-03-25 14:36:44 +0100
commit1b6ce80c2bc3e16397b688ce217e049cebaa460a (patch)
treebd0e1a1f199051b4b5bf9d3fc4adfa09f0bf8ee1 /nixos/tests
parent11b89720b7920d4b2cf1a5d2bc54ced5797ea477 (diff)
downloadnixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar.gz
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar.bz2
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar.lz
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar.xz
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.tar.zst
nixlib-1b6ce80c2bc3e16397b688ce217e049cebaa460a.zip
Make it pass a minimal test
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/prometheus-2.nix34
1 files changed, 34 insertions, 0 deletions
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");
+  '';
+}