summary refs log tree commit diff
path: root/nixos/tests/magnetico.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-08-31 10:04:20 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-08-31 10:04:20 +0200
commitad1d58c6227abf2a9c80311eb09166a532384ed2 (patch)
tree852498ff298f9b01c0d2c8b4c883da1a00912260 /nixos/tests/magnetico.nix
parentebe4fd146b29c92fb59f243f75e46afc9f1a9048 (diff)
parentfc74ba8291a8a93cba428de6bc2e7c8c7f9330f4 (diff)
Merge staging-next into staging
Diffstat (limited to 'nixos/tests/magnetico.nix')
-rw-r--r--nixos/tests/magnetico.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/tests/magnetico.nix b/nixos/tests/magnetico.nix
new file mode 100644
index 0000000000000..bc7aef653ee52
--- /dev/null
+++ b/nixos/tests/magnetico.nix
@@ -0,0 +1,28 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "magnetico";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ rnhmjoj ];
+  };
+
+  machine = { ... }: {
+    imports = [ ../modules/profiles/minimal.nix ];
+
+    networking.firewall.allowedTCPPorts = [ 9000 ];
+
+    services.magnetico = {
+      enable = true;
+      crawler.port = 9000;
+      web.credentials.user = "$2y$12$P88ZF6soFthiiAeXnz64aOWDsY3Dw7Yw8fZ6GtiqFNjknD70zDmNe";
+    };
+  };
+
+  testScript =
+    ''
+      startAll;
+      $machine->waitForUnit("magneticod");
+      $machine->waitForUnit("magneticow");
+      $machine->succeed("${pkgs.curl}/bin/curl -u user:password http://localhost:8080");
+      $machine->succeed("${pkgs.curl}/bin/curl -u user:wrongpwd http://localhost:8080") =~ "Unauthorised." or die;
+      $machine->shutdown();
+    '';
+})