From 712a04c693f202b1d7e7ea61e6926d4d4a7b3280 Mon Sep 17 00:00:00 2001 From: RatCornu Date: Fri, 9 Feb 2024 20:06:25 +0100 Subject: [PATCH] nixos/pingvin-share: add nixos test --- nixos/tests/all-tests.nix | 1 + nixos/tests/pingvin-share.nix | 40 ++++++++++++++----------- pkgs/servers/pingvin-share/backend.nix | 5 ++++ pkgs/servers/pingvin-share/frontend.nix | 5 ++++ 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 1fade3d88a7b..f1ecd44a1f99 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -763,6 +763,7 @@ in { php83 = handleTest ./php { php = pkgs.php83; }; phylactery = handleTest ./web-apps/phylactery.nix {}; pict-rs = handleTest ./pict-rs.nix {}; + pingvin-share = handleTest ./pingvin-share.nix {} ; pinnwand = handleTest ./pinnwand.nix {}; plantuml-server = handleTest ./plantuml-server.nix {}; plasma-bigscreen = handleTest ./plasma-bigscreen.nix {}; diff --git a/nixos/tests/pingvin-share.nix b/nixos/tests/pingvin-share.nix index beb2005f49d2..5b1ec55add20 100644 --- a/nixos/tests/pingvin-share.nix +++ b/nixos/tests/pingvin-share.nix @@ -1,20 +1,26 @@ -import ./make-test-python.nix ({ lib, pkgs, ... }: { - name = "pingvin-share"; - meta.maintainers = with lib.maintainers; [ ratcornu ]; +import ./make-test-python.nix ( + { lib, ... }: + { + name = "pingvin-share"; + meta.maintainers = with lib.maintainers; [ ratcornu ]; - nodes.machine = { pkgs, ... }: { - services.pingvin-share = { - enable = true; + nodes.machine = + { ... }: + { + services.pingvin-share = { + enable = true; - backend.port = 9010; - frontend.port = 9011; - }; - }; + backend.port = 9010; + frontend.port = 9011; + }; + }; - testScript = '' - machine.wait_for_unit("pingvin-share-frontend.service") - machine.wait_for_open_port(9011) - machine.succeed("curl --fail http://127.0.0.1:9010/") - machine.succeed("curl --fail http://127.0.0.1:9011/") - ''; -}) + testScript = '' + machine.wait_for_unit("pingvin-share-frontend.service") + machine.wait_for_open_port(9010) + machine.wait_for_open_port(9011) + machine.succeed("curl --fail http://127.0.0.1:9010/api/configs") + machine.succeed("curl --fail http://127.0.0.1:9011/") + ''; + } +) diff --git a/pkgs/servers/pingvin-share/backend.nix b/pkgs/servers/pingvin-share/backend.nix index 3715a653aed6..47baa5d1a48d 100644 --- a/pkgs/servers/pingvin-share/backend.nix +++ b/pkgs/servers/pingvin-share/backend.nix @@ -6,6 +6,7 @@ nodePackages, src, version, + nixosTests, }: buildNpmPackage { @@ -34,6 +35,10 @@ buildNpmPackage { makeCacheWritable = true; npmFlags = [ "--legacy-peer-deps" ]; + passthru.tests = { + pingvin-share = nixosTests.pingvin-share; + }; + meta = with lib; { description = "Backend of pingvin-share, a self-hosted file sharing platform"; homepage = "https://github.com/stonith404/pingvin-share"; diff --git a/pkgs/servers/pingvin-share/frontend.nix b/pkgs/servers/pingvin-share/frontend.nix index ff817506f8d8..eaddc1f6f01e 100644 --- a/pkgs/servers/pingvin-share/frontend.nix +++ b/pkgs/servers/pingvin-share/frontend.nix @@ -5,6 +5,7 @@ pkg-config, src, version, + nixosTests, }: buildNpmPackage { @@ -26,6 +27,10 @@ buildNpmPackage { makeCacheWritable = true; npmFlags = [ "--legacy-peer-deps" ]; + passthru.tests = { + pingvin-share = nixosTests.pingvin-share; + }; + meta = with lib; { description = "Frontend of pingvin-share, a self-hosted file sharing platform"; homepage = "https://github.com/stonith404/pingvin-share";