about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohannes Schleifenbaum <johannes@js-webcoding.de>2021-09-21 13:38:22 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2021-12-06 21:08:19 +0100
commit9f45c185155f92f8c6adddcb5fa64b7849d8f382 (patch)
treee703760ec7d3e827a8a25abd16e546bf257edbb2
parent12efd19b16bfcc6f1bf2163cff3797fa03297390 (diff)
sabnzbd: add simple test
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/sabnzbd.nix22
-rw-r--r--pkgs/servers/sabnzbd/default.nix5
3 files changed, 28 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 8ac3f6043d084..bee2935b84fbb 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -408,6 +408,7 @@ in
   rss2email = handleTest ./rss2email.nix {};
   rsyslogd = handleTest ./rsyslogd.nix {};
   rxe = handleTest ./rxe.nix {};
+  sabnzbd = handleTest ./sabnzbd.nix {};
   samba = handleTest ./samba.nix {};
   samba-wsdd = handleTest ./samba-wsdd.nix {};
   sanoid = handleTest ./sanoid.nix {};
diff --git a/nixos/tests/sabnzbd.nix b/nixos/tests/sabnzbd.nix
new file mode 100644
index 0000000000000..fb35b212b493b
--- /dev/null
+++ b/nixos/tests/sabnzbd.nix
@@ -0,0 +1,22 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }: {
+  name = "sabnzbd";
+  meta = with pkgs.lib; {
+    maintainers = with maintainers; [ jojosch ];
+  };
+
+  machine = { pkgs, ... }: {
+    services.sabnzbd = {
+      enable = true;
+    };
+
+    # unrar is unfree
+    nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "unrar" ];
+  };
+
+  testScript = ''
+    machine.wait_for_unit("sabnzbd.service")
+    machine.wait_until_succeeds(
+        "curl --fail -L http://localhost:8080/"
+    )
+  '';
+})
diff --git a/pkgs/servers/sabnzbd/default.nix b/pkgs/servers/sabnzbd/default.nix
index 9b391eac8e61c..d5be13bde3782 100644
--- a/pkgs/servers/sabnzbd/default.nix
+++ b/pkgs/servers/sabnzbd/default.nix
@@ -6,6 +6,7 @@
 , unrar
 , p7zip
 , makeWrapper
+, nixosTests
 }:
 
 let
@@ -48,6 +49,10 @@ in stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
+  passthru.tests = {
+    smoke-test = nixosTests.sabnzbd;
+  };
+
   meta = with lib; {
     description = "Usenet NZB downloader, par2 repairer and auto extracting server";
     homepage = "https://sabnzbd.org";