From 9569752c0a9cf46d5eaf8e8c1229f2fb7a2c202c Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Sun, 2 Feb 2025 19:01:30 +0000 Subject: [PATCH] nixos/tests/pairdrop: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/web-apps/pairdrop.nix | 32 ++++++++++++++++++++++++++++ pkgs/by-name/pa/pairdrop/package.nix | 7 ++++++ 3 files changed, 40 insertions(+) create mode 100644 nixos/tests/web-apps/pairdrop.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 86b223ad06f2..5ddcd2484b4a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1149,6 +1149,7 @@ in oxidized = handleTest ./oxidized.nix { }; pacemaker = runTest ./pacemaker.nix; packagekit = runTest ./packagekit.nix; + pairdrop = runTest ./web-apps/pairdrop.nix; paisa = runTest ./paisa.nix; pam-file-contents = runTest ./pam/pam-file-contents.nix; pam-lastlog = runTest ./pam/pam-lastlog.nix; diff --git a/nixos/tests/web-apps/pairdrop.nix b/nixos/tests/web-apps/pairdrop.nix new file mode 100644 index 000000000000..bf404edfa7eb --- /dev/null +++ b/nixos/tests/web-apps/pairdrop.nix @@ -0,0 +1,32 @@ +{ ... }: +{ + name = "pairdrop-nixos"; + + nodes.machine = + { pkgs, ... }: + { + services.pairdrop = { + enable = true; + port = 1337; + environment = { + SIGNALING_SERVER = "pairdrop.net"; + CUSTOM_BUTTON_ACTIVE = false; + }; + }; + }; + + testScript = '' + import json + + machine.wait_for_unit("pairdrop.service") + + machine.wait_for_open_port(1337) + machine.succeed("curl --fail http://localhost:1337/") + + res = machine.succeed("curl --fail http://localhost:1337/config") + print(res) + cfg = json.loads(res) + assert cfg["signalingServer"] == "pairdrop.net/" + assert cfg["buttons"]["custom_button"]["active"] == "false" + ''; +} diff --git a/pkgs/by-name/pa/pairdrop/package.nix b/pkgs/by-name/pa/pairdrop/package.nix index d4b2aa08b70c..1fa983f47b26 100644 --- a/pkgs/by-name/pa/pairdrop/package.nix +++ b/pkgs/by-name/pa/pairdrop/package.nix @@ -2,6 +2,7 @@ lib, buildNpmPackage, fetchFromGitHub, + nixosTests, nodejs, }: @@ -36,6 +37,12 @@ buildNpmPackage rec { runHook postInstall ''; + passthru = { + tests = { + inherit (nixosTests) pairdrop; + }; + }; + meta = with lib; { description = "Local file sharing in your browser"; mainProgram = "pairdrop";