python312Packages.homematicip: 1.1.2 -> 1.1.3 (#356780)
[NixPkgs.git] / nixos / tests / trickster.nix
blobacb2e735c39f85d9ac8cf1d5f90fa625326a54de
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "trickster";
3   meta = with pkgs.lib; {
4     maintainers = with maintainers; [ _1000101 ];
5   };
7   nodes = {
8     prometheus = { ... }: {
9       services.prometheus.enable = true;
10       networking.firewall.allowedTCPPorts = [ 9090 ];
11     };
12     trickster = { ... }: {
13       services.trickster.enable = true;
14     };
15   };
17   testScript = ''
18     start_all()
19     prometheus.wait_for_unit("prometheus.service")
20     prometheus.wait_for_open_port(9090)
21     prometheus.wait_until_succeeds(
22         "curl -fL http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
23     )
24     trickster.wait_for_unit("trickster.service")
25     trickster.wait_for_open_port(8082)
26     trickster.wait_for_open_port(9090)
27     trickster.wait_until_succeeds(
28         "curl -fL http://localhost:8082/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
29     )
30     trickster.wait_until_succeeds(
31         "curl -fL http://prometheus:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
32     )
33     trickster.wait_until_succeeds(
34         "curl -fL http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
35     )
36   '';