From 3cfdd35ff6f3debac56261d35c06537697e8fe98 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 10 Jun 2022 14:54:16 +0200 Subject: [PATCH] zeronet-conservancy: add nixos test --- nixos/tests/all-tests.nix | 1 + nixos/tests/zeronet-conservancy.nix | 25 +++++++++++++++++++ .../p2p/zeronet-conservancy/default.nix | 5 ++++ 3 files changed, 31 insertions(+) create mode 100644 nixos/tests/zeronet-conservancy.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 38c320886d1a..521b3364a8d0 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -613,6 +613,7 @@ in { yabar = handleTest ./yabar.nix {}; yggdrasil = handleTest ./yggdrasil.nix {}; zammad = handleTest ./zammad.nix {}; + zeronet-conservancy = handleTest ./zeronet-conservancy.nix {}; zfs = handleTest ./zfs.nix {}; zigbee2mqtt = handleTest ./zigbee2mqtt.nix {}; zoneminder = handleTest ./zoneminder.nix {}; diff --git a/nixos/tests/zeronet-conservancy.nix b/nixos/tests/zeronet-conservancy.nix new file mode 100644 index 000000000000..8cb649cbdaab --- /dev/null +++ b/nixos/tests/zeronet-conservancy.nix @@ -0,0 +1,25 @@ +let + port = 43110; +in +import ./make-test-python.nix ({ pkgs, ... }: { + name = "zeronet-conservancy"; + meta = with pkgs.lib.maintainers; { + maintainers = [ fgaz ]; + }; + + nodes.machine = { config, pkgs, ... }: { + services.zeronet = { + enable = true; + package = pkgs.zeronet-conservancy; + inherit port; + }; + }; + + testScript = '' + machine.wait_for_unit("zeronet.service") + + machine.wait_for_open_port(${toString port}) + + machine.succeed("curl --fail -H 'Accept: text/html, application/xml, */*' localhost:${toString port}/Stats") + ''; +}) diff --git a/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix b/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix index c52ea16d422f..951e42475e18 100644 --- a/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix +++ b/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix @@ -1,6 +1,7 @@ { lib , fetchFromGitHub , python3Packages +, nixosTests }: python3Packages.buildPythonApplication rec { @@ -35,6 +36,10 @@ python3Packages.buildPythonApplication rec { --set PATH ${python3Packages.python}/bin ''; + passthru.tests = { + nixos-test = nixosTests.zeronet-conservancy; + }; + meta = with lib; { description = "A fork/continuation of the ZeroNet project"; longDescription = ''