about summary refs log tree commit diff
path: root/nixos/tests/trickster.nix
blob: 1461a32bb07e860c0fae862703e7ee87d7e6642a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import ./make-test.nix ({ pkgs, ... }: {
  name = "trickster";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ "1000101" ];
  };

  nodes = {
    prometheus = { ... }: {
      services.prometheus.enable = true;
      networking.firewall.allowedTCPPorts = [ 9090 ];
    };
    trickster = { ... }: {
      services.trickster.enable = true;
    };
  };

  testScript = ''
    startAll;
    $prometheus->waitForUnit("prometheus.service");
    $prometheus->waitForOpenPort(9090);
    $prometheus->waitUntilSucceeds("curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
    $trickster->waitForUnit("trickster.service");
    $trickster->waitForOpenPort(8082);
    $trickster->waitForOpenPort(9090);
    $trickster->waitUntilSucceeds("curl -L http://localhost:8082/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
    $trickster->waitUntilSucceeds("curl -L http://prometheus:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
    $trickster->waitUntilSucceeds("curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
  '';
})