nixos/pyload: init test

This commit is contained in:
Bruno BELANYI 2023-12-24 22:23:15 +01:00
parent 70d0a6e547
commit 60518d6a52
3 changed files with 49 additions and 9 deletions

View file

@ -387,6 +387,7 @@ in {
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
invidious = handleTest ./invidious.nix {};
livebook-service = handleTest ./livebook-service.nix {};
pyload = handleTest ./pyload.nix {};
oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
odoo = handleTest ./odoo.nix {};
odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; };

33
nixos/tests/pyload.nix Normal file
View file

@ -0,0 +1,33 @@
import ./make-test-python.nix ({ lib, ... }: {
name = "pyload";
meta.maintainers = with lib.maintainers; [ ambroisie ];
nodes = {
machine = { ... }: {
services.pyload = {
enable = true;
listenAddress = "0.0.0.0";
port = 9876;
};
networking.firewall.allowedTCPPorts = [ 9876 ];
};
client = { };
};
testScript = ''
start_all()
machine.wait_for_unit("pyload.service")
with subtest("Web interface accessible locally"):
machine.wait_until_succeeds("curl -fs localhost:9876")
client.wait_for_unit("network.target")
with subtest("Web interface accessible from a different machine"):
client.wait_until_succeeds("curl -fs machine:9876")
'';
})

View file

@ -1,4 +1,4 @@
{ lib, fetchPypi, python3 }:
{ lib, fetchPypi, nixosTests, python3 }:
python3.pkgs.buildPythonApplication rec {
version = "0.5.0b3.dev75";
@ -43,7 +43,8 @@ python3.pkgs.buildPythonApplication rec {
setuptools
];
passthru.optional-dependencies = {
passthru = {
optional-dependencies = {
plugins = with python3.pkgs; [
beautifulsoup4 # for some plugins
colorlog # colorful console logging
@ -53,6 +54,11 @@ python3.pkgs.buildPythonApplication rec {
];
};
tests = {
inherit (nixosTests) pyload;
};
};
meta = with lib; {
description = "Free and open-source download manager with support for 1-click-hosting sites";
homepage = "https://github.com/pyload/pyload";