From 4adb3dd7decf722c69792c92a425c796328a7da0 Mon Sep 17 00:00:00 2001 From: Jan Hrnko Date: Fri, 1 Nov 2019 11:03:23 +0100 Subject: [PATCH] nixos/trickster: add test --- nixos/tests/all-tests.nix | 1 + nixos/tests/trickster.nix | 29 ++++++++++++++++++++++++++++ pkgs/servers/trickster/trickster.nix | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/trickster.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 694376b9d36..a407ec1ac22 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -276,6 +276,7 @@ in tor = handleTest ./tor.nix {}; transmission = handleTest ./transmission.nix {}; trezord = handleTest ./trezord.nix {}; + trickster = handleTest ./trickster.nix {}; udisks2 = handleTest ./udisks2.nix {}; upnp = handleTest ./upnp.nix {}; uwsgi = handleTest ./uwsgi.nix {}; diff --git a/nixos/tests/trickster.nix b/nixos/tests/trickster.nix new file mode 100644 index 00000000000..1461a32bb07 --- /dev/null +++ b/nixos/tests/trickster.nix @@ -0,0 +1,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'"); + ''; +}) \ No newline at end of file diff --git a/pkgs/servers/trickster/trickster.nix b/pkgs/servers/trickster/trickster.nix index c219300ca21..3c03193e770 100644 --- a/pkgs/servers/trickster/trickster.nix +++ b/pkgs/servers/trickster/trickster.nix @@ -22,6 +22,6 @@ buildGoPackage rec { homepage = "https://github.com/Comcast/trickster"; license = licenses.asl20; maintainers = with maintainers; [ maintainers."1000101" ]; - platforms = platforms.linux; + platforms = platforms.all; }; } \ No newline at end of file