1import ./make-test-python.nix (
2 { pkgs, lib, ... }:
3 {
4 name = "lanraragi";
5 meta.maintainers = with lib.maintainers; [ tomasajt ];
6
7 nodes = {
8 machine1 =
9 { pkgs, ... }:
10 {
11 services.lanraragi.enable = true;
12 };
13 machine2 =
14 { pkgs, ... }:
15 {
16 services.lanraragi = {
17 enable = true;
18 passwordFile = pkgs.writeText "lrr-test-pass" ''
19 Ultra-secure-p@ssword-"with-spec1al\chars
20 '';
21 port = 4000;
22 redis = {
23 port = 4001;
24 passwordFile = pkgs.writeText "redis-lrr-test-pass" ''
25 123-redis-PASS
26 '';
27 };
28 };
29 };
30 };
31
32 testScript = ''
33 start_all()
34
35 machine1.wait_for_unit("lanraragi.service")
36 machine1.wait_until_succeeds("curl -f localhost:3000")
37 machine1.succeed("[ $(curl -o /dev/null -X post 'http://localhost:3000/login' --data-raw 'password=kamimamita' -w '%{http_code}') -eq 302 ]")
38
39 machine2.wait_for_unit("lanraragi.service")
40 machine2.wait_until_succeeds("curl -f localhost:4000")
41 machine2.succeed("[ $(curl -o /dev/null -X post 'http://localhost:4000/login' --data-raw 'password=Ultra-secure-p@ssword-\"with-spec1al\\chars' -w '%{http_code}') -eq 302 ]")
42 '';
43 }
44)