diff options
Diffstat (limited to 'nixos/tests/prometheus-2.nix')
-rw-r--r-- | nixos/tests/prometheus-2.nix | 34 |
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"); + ''; +} |