vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / mimir.nix
blobf1b30d261472b95a287b4d2a8a00b87a5aa4c552
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "mimir";
3   nodes = {
4     server = { ... }: {
5       environment.systemPackages = [ pkgs.jq ];
6       services.mimir.enable = true;
7       services.mimir.configuration = {
8         ingester.ring.replication_factor = 1;
9       };
11       services.telegraf.enable = true;
12       services.telegraf.extraConfig = {
13         agent.interval = "1s";
14         agent.flush_interval = "1s";
15         inputs.exec = {
16           commands = [
17             "${pkgs.coreutils}/bin/echo 'foo i=42i'"
18           ];
19           data_format = "influx";
20         };
21         outputs = {
22           http = {
23             # test remote write
24             url = "http://localhost:8080/api/v1/push";
26             # Data format to output.
27             data_format = "prometheusremotewrite";
29             headers = {
30               Content-Type = "application/x-protobuf";
31               Content-Encoding = "snappy";
32               X-Scope-OrgID = "nixos";
33               X-Prometheus-Remote-Write-Version = "0.1.0";
34             };
35           };
36         };
37       };
38     };
39   };
41   testScript = ''
42     start_all()
43     server.wait_for_unit("mimir.service")
44     server.wait_for_unit("telegraf.service")
45     server.wait_for_open_port(8080)
46     server.wait_until_succeeds(
47         "curl -H 'X-Scope-OrgID: nixos' http://127.0.0.1:8080/prometheus/api/v1/label/host/values | jq -r '.data[0]' | grep server"
48     )
49   '';