nixpkgs/nixos/tests/prometheus.nix
Bjørn Forsman 774d05878a nixos/tests: unbreak prometheus test
Commit 271d3f7a43 ("prometheus service: globalConfig.labels is obsolete")
removed globalConfig.labels. Update the test config accordingly.
2017-10-16 20:31:49 +02:00

26 lines
625 B
Nix

import ./make-test.nix {
name = "prometheus";
nodes = {
one = { config, pkgs, ... }: {
services.prometheus = {
enable = true;
scrapeConfigs = [{
job_name = "prometheus";
static_configs = [{
targets = [ "127.0.0.1:9090" ];
labels = { instance = "localhost"; };
}];
}];
rules = [ ''testrule = count(up{job="prometheus"})'' ];
};
};
};
testScript = ''
startAll;
$one->waitForUnit("prometheus.service");
$one->waitForOpenPort(9090);
$one->succeed("curl -s http://127.0.0.1:9090/metrics");
'';
}