Skip to content

Commit

Permalink
nixos/tests/linkwarden: init tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanbruegge committed Dec 23, 2024
1 parent ea70581 commit 546b2c0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ in {
lightdm = handleTest ./lightdm.nix {};
lighttpd = handleTest ./lighttpd.nix {};
limesurvey = handleTest ./limesurvey.nix {};
linkwarden = handleTest ./web-apps/linkwarden.nix {};
listmonk = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./listmonk.nix {};
litestream = handleTest ./litestream.nix {};
lldap = handleTest ./lldap.nix {};
Expand Down
30 changes: 30 additions & 0 deletions nixos/tests/web-apps/linkwarden.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import ../make-test-python.nix (
{ ... }:
{
name = "linkwarden-nixos";

nodes.machine =
{ pkgs, ... }:
let
secretsFile = pkgs.writeText "linkwarden-secret-env" ''
NEXTAUTH_SECRET=VERY_SENSITIVE_SECRET
'';
in
{
services.linkwarden = {
enable = true;
enableRegistration = true;
secretsFile = toString secretsFile;
};
};

testScript = ''
machine.wait_for_unit("linkwarden.service")
machine.wait_for_open_port(3000)
machine.succeed("curl --fail -s http://localhost:3000/")
machine.succeed("curl -L --fail -s --data '{\"name\":\"Admin\",\"username\":\"admin\",\"password\":\"adminadmin\"}' -H 'Content-Type: application/json' -X POST http://localhost:3000/api/v1/users")
'';
}
)
5 changes: 5 additions & 0 deletions pkgs/by-name/li/linkwarden/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
fetchFromGitHub,
fetchYarnDeps,
makeWrapper,
nixosTests,
yarnBuildHook,
yarnConfigHook,
# dependencies
Expand Down Expand Up @@ -126,6 +127,10 @@ stdenvNoCC.mkDerivation rec {
hash = "sha256-IA5rPRIvk9MTToAH6B+hf9C3hAZLkuTm8YHFwh8WMHo=";
};

passthru.tests = {
inherit (nixosTests) linkwarden;
};

meta = {
description = "Self-hosted collaborative bookmark manager to collect, organize, and preserve webpages, articles, and more...";
homepage = "https://linkwarden.app/";
Expand Down

0 comments on commit 546b2c0

Please sign in to comment.