Skip to content

Commit 91b4c97

Browse files
committed
nixos/lavalink: add nixos test
1 parent 8204df5 commit 91b4c97

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ in
713713
languagetool = handleTest ./languagetool.nix { };
714714
lanraragi = handleTest ./lanraragi.nix { };
715715
latestKernel.login = handleTest ./login.nix { latestKernel = true; };
716+
lavalink = runTest ./lavalink.nix;
716717
leaps = handleTest ./leaps.nix { };
717718
lemmy = handleTest ./lemmy.nix { };
718719
libinput = handleTest ./libinput.nix { };

nixos/tests/lavalink.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{ lib, ... }:
2+
3+
let
4+
password = "s3cRe!p4SsW0rD";
5+
in
6+
7+
{
8+
name = "lavalink";
9+
meta.maintainers = with lib.maintainers; [ nanoyaki ];
10+
11+
nodes = {
12+
machine = {
13+
services.lavalink = {
14+
enable = true;
15+
port = 1234;
16+
inherit password;
17+
};
18+
};
19+
machine2 =
20+
{ pkgs, ... }:
21+
{
22+
services.lavalink = {
23+
enable = true;
24+
port = 1235;
25+
environmentFile = "${pkgs.writeText "passwordEnvFile" ''
26+
LAVALINK_SERVER_PASSWORD=${password}
27+
''}";
28+
};
29+
};
30+
};
31+
32+
testScript = ''
33+
start_all()
34+
35+
machine.wait_for_unit("lavalink.service")
36+
machine.wait_for_open_port(1234)
37+
machine.succeed("curl --header \"User-Id: 1204475253028429844\" --header \"Client-Name: shoukaku/4.1.1\" --header \"Authorization: ${password}\" http://localhost:1234/v4/info --fail -v")
38+
39+
machine2.wait_for_unit("lavalink.service")
40+
machine2.wait_for_open_port(1235)
41+
machine2.succeed("curl --header \"User-Id: 1204475253028429844\" --header \"Client-Name: shoukaku/4.1.1\" --header \"Authorization: ${password}\" http://localhost:1235/v4/info --fail -v")
42+
'';
43+
}

0 commit comments

Comments
 (0)