From 1144486f3a330c1e3a005022246db4eac194225d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:15:41 +0000 Subject: [PATCH] nixos/tests/podgrab: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/podgrab.nix | 34 +++++++++++++++++++++++++++ pkgs/servers/misc/podgrab/default.nix | 4 +++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/podgrab.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 47384cf5a8a..1a6df8a181c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -321,6 +321,7 @@ in pleroma = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./pleroma.nix {}; plikd = handleTest ./plikd.nix {}; plotinus = handleTest ./plotinus.nix {}; + podgrab = handleTest ./podgrab.nix {}; podman = handleTestOn ["x86_64-linux"] ./podman.nix {}; pomerium = handleTestOn ["x86_64-linux"] ./pomerium.nix {}; postfix = handleTest ./postfix.nix {}; diff --git a/nixos/tests/podgrab.nix b/nixos/tests/podgrab.nix new file mode 100644 index 00000000000..e927e25fea5 --- /dev/null +++ b/nixos/tests/podgrab.nix @@ -0,0 +1,34 @@ +let + defaultPort = 8080; + customPort = 4242; +in +import ./make-test-python.nix ({ pkgs, ... }: { + name = "podgrab"; + + nodes = { + default = { ... }: { + services.podgrab.enable = true; + }; + + customized = { ... }: { + services.podgrab = { + enable = true; + port = customPort; + }; + }; + }; + + testScript = '' + start_all() + + default.wait_for_unit("podgrab") + default.wait_for_open_port("${toString defaultPort}") + default.succeed("curl --fail http://localhost:${toString defaultPort}") + + customized.wait_for_unit("podgrab") + customized.wait_for_open_port("${toString customPort}") + customized.succeed("curl --fail http://localhost:${toString customPort}") + ''; + + meta.maintainers = with pkgs.lib.maintainers; [ ambroisie ]; +}) diff --git a/pkgs/servers/misc/podgrab/default.nix b/pkgs/servers/misc/podgrab/default.nix index 6703fbc53ed..a5fd230d48f 100644 --- a/pkgs/servers/misc/podgrab/default.nix +++ b/pkgs/servers/misc/podgrab/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildGoModule }: +{ lib, fetchFromGitHub, buildGoModule, nixosTests }: buildGoModule rec { pname = "podgrab"; @@ -19,6 +19,8 @@ buildGoModule rec { cp -r $src/webassets $out/share/ ''; + passthru.tests = { inherit (nixosTests) podgrab; }; + meta = with lib; { description = "A self-hosted podcast manager to download episodes as soon as they become live"; homepage = "https://github.com/akhilrex/podgrab";