Skip to content

Commit a4bdbb9

Browse files
committed
nixos/tests/linkwarden: init tests
1 parent 0fd43a4 commit a4bdbb9

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ in {
547547
lightdm = handleTest ./lightdm.nix {};
548548
lighttpd = handleTest ./lighttpd.nix {};
549549
limesurvey = handleTest ./limesurvey.nix {};
550+
linkwarden = handleTest ./web-apps/linkwarden.nix {};
550551
listmonk = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./listmonk.nix {};
551552
litestream = handleTest ./litestream.nix {};
552553
lldap = handleTest ./lldap.nix {};

nixos/tests/web-apps/linkwarden.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import ../make-test-python.nix (
2+
{ ... }:
3+
{
4+
name = "linkwarden-nixos";
5+
6+
nodes.machine =
7+
{ pkgs, ... }:
8+
let
9+
secretsFile = pkgs.writeText "linkwarden-secret-env" ''
10+
NEXTAUTH_SECRET=VERY_SENSITIVE_SECRET
11+
'';
12+
in
13+
{
14+
services.linkwarden = {
15+
enable = true;
16+
enableRegistration = true;
17+
secretsFile = toString secretsFile;
18+
};
19+
};
20+
21+
testScript = ''
22+
machine.wait_for_unit("linkwarden.service")
23+
24+
machine.wait_for_open_port(3000)
25+
machine.succeed("curl --fail -s http://localhost:3000/")
26+
27+
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")
28+
'';
29+
}
30+
)

pkgs/by-name/li/linkwarden/package.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
fetchFromGitHub,
66
fetchYarnDeps,
77
makeWrapper,
8+
nixosTests,
89
yarnBuildHook,
910
yarnConfigHook,
1011
# dependencies
@@ -126,6 +127,10 @@ stdenvNoCC.mkDerivation rec {
126127
hash = "sha256-IA5rPRIvk9MTToAH6B+hf9C3hAZLkuTm8YHFwh8WMHo=";
127128
};
128129

130+
passthru.tests = {
131+
inherit (nixosTests) linkwarden;
132+
};
133+
129134
meta = {
130135
description = "Self-hosted collaborative bookmark manager to collect, organize, and preserve webpages, articles, and more...";
131136
homepage = "https://linkwarden.app/";

0 commit comments

Comments
 (0)