about summary refs log tree commit diff
path: root/nixos/tests/lanraragi.nix
diff options
context:
space:
mode:
authorTomaSajt <62384384+TomaSajt@users.noreply.github.com>2023-09-17 17:12:55 +0200
committerTomaSajt <62384384+TomaSajt@users.noreply.github.com>2023-10-25 01:14:59 +0200
commit8e18ff0c2418df507eff96f4b199ea6002485f2f (patch)
tree7cdddd16476b0e27ae3820455de05ccbddb4cf78 /nixos/tests/lanraragi.nix
parent91941994fb42cd1a34e51bee9cd4c66c4be4ca88 (diff)
nixos/lanraragi: init
Diffstat (limited to 'nixos/tests/lanraragi.nix')
-rw-r--r--nixos/tests/lanraragi.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/nixos/tests/lanraragi.nix b/nixos/tests/lanraragi.nix
new file mode 100644
index 0000000000000..f513ac9d252bc
--- /dev/null
+++ b/nixos/tests/lanraragi.nix
@@ -0,0 +1,40 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }: {
+  name = "lanraragi";
+  meta.maintainers = with lib.maintainers; [ tomasajt ];
+
+  nodes = {
+    machine1 = { pkgs, ... }: {
+      services.lanraragi.enable = true;
+    };
+    machine2 = { pkgs, ... }: {
+      services.lanraragi = {
+        enable = true;
+        passwordFile = pkgs.writeText "lrr-test-pass" ''
+          ultra-secure-password
+        '';
+        port = 4000;
+        redis = {
+          port = 4001;
+          passwordFile = pkgs.writeText "redis-lrr-test-pass" ''
+            still-a-very-secure-password
+          '';
+        };
+      };
+    };
+
+
+  };
+
+  testScript = ''
+    start_all()
+
+    machine1.wait_for_unit("lanraragi.service")
+    machine1.wait_until_succeeds("curl -f localhost:3000")
+    machine1.succeed("[ $(curl -o /dev/null -X post 'http://localhost:3000/login' --data-raw 'password=kamimamita' -w '%{http_code}') -eq 302 ]")
+
+    machine2.wait_for_unit("lanraragi.service")
+    machine2.wait_until_succeeds("curl -f localhost:4000")
+    machine2.succeed("[ $(curl -o /dev/null -X post 'http://localhost:4000/login' --data-raw 'password=ultra-secure-password' -w '%{http_code}') -eq 302 ]")
+  '';
+})
+