about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2024-02-13 19:41:11 +0100
committerGitHub <noreply@github.com>2024-02-13 19:41:11 +0100
commitbf7c95ce73d652d045a441403c06b4fbceaba179 (patch)
tree61a86ed89c6da447c149f2fddc1434bc7a299cdf /nixos/tests
parent9858b3962a5944deb26b3e3907f270fceecd2b19 (diff)
parenta8880f1647e6b8e83f1f9909bea17d4c0dbe8428 (diff)
Merge pull request #285314 from pbsds/ttyd-1706718068
nixos/ttyd: add `entrypoint` and `writable` option
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/web-servers/ttyd.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/nixos/tests/web-servers/ttyd.nix b/nixos/tests/web-servers/ttyd.nix
index d161673684b31..b79a2032ec75a 100644
--- a/nixos/tests/web-servers/ttyd.nix
+++ b/nixos/tests/web-servers/ttyd.nix
@@ -2,18 +2,28 @@ import ../make-test-python.nix ({ lib, pkgs, ... }: {
   name = "ttyd";
   meta.maintainers = with lib.maintainers; [ stunkymonkey ];
 
-  nodes.machine = { pkgs, ... }: {
+  nodes.readonly = { pkgs, ... }: {
+    services.ttyd = {
+      enable = true;
+      entrypoint = [ (lib.getExe pkgs.htop) ];
+      writeable = false;
+    };
+  };
+
+  nodes.writeable = { pkgs, ... }: {
     services.ttyd = {
       enable = true;
       username = "foo";
       passwordFile = pkgs.writeText "password" "bar";
+      writeable = true;
     };
   };
 
   testScript = ''
-    machine.wait_for_unit("ttyd.service")
-    machine.wait_for_open_port(7681)
-    response = machine.succeed("curl -vvv -u foo:bar -s -H 'Host: ttyd' http://127.0.0.1:7681/")
-    assert '<title>ttyd - Terminal</title>' in response, "Page didn't load successfully"
+    for machine in [readonly, writeable]:
+      machine.wait_for_unit("ttyd.service")
+      machine.wait_for_open_port(7681)
+      response = machine.succeed("curl -vvv -u foo:bar -s -H 'Host: ttyd' http://127.0.0.1:7681/")
+      assert '<title>ttyd - Terminal</title>' in response, "Page didn't load successfully"
   '';
 })