about summary refs log tree commit diff
path: root/nixos/tests/merecat.nix
diff options
context:
space:
mode:
authorFrancesco Gazzetta <fgaz@fgaz.me>2022-10-19 10:49:57 +0200
committerFrancesco Gazzetta <fgaz@fgaz.me>2022-10-31 09:24:28 +0100
commitb43605fb031248ddb615b7caf562ccfcb49f910d (patch)
tree88a8ff0f48ebd39d18261a65fe470634e655289e /nixos/tests/merecat.nix
parentada312b3c41a24dd8a5c78903a09281857fecb55 (diff)
nixos/merecat: init
Diffstat (limited to 'nixos/tests/merecat.nix')
-rw-r--r--nixos/tests/merecat.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/tests/merecat.nix b/nixos/tests/merecat.nix
new file mode 100644
index 0000000000000..9d8f66165ee90
--- /dev/null
+++ b/nixos/tests/merecat.nix
@@ -0,0 +1,28 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "merecat";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ fgaz ];
+  };
+
+  nodes.machine = { config, pkgs, ... }: {
+    services.merecat = {
+      enable = true;
+      settings = {
+        hostname = "localhost";
+        virtual-host = true;
+        directory = toString (pkgs.runCommand "merecat-webdir" {} ''
+          mkdir -p $out/foo.localhost $out/bar.localhost
+          echo '<h1>Hello foo</h1>' > $out/foo.localhost/index.html
+          echo '<h1>Hello bar</h1>' > $out/bar.localhost/index.html
+        '');
+      };
+    };
+  };
+
+  testScript = ''
+    machine.wait_for_unit("merecat")
+    machine.wait_for_open_port(80)
+    machine.succeed("curl --fail foo.localhost | grep 'Hello foo'")
+    machine.succeed("curl --fail bar.localhost | grep 'Hello bar'")
+  '';
+})