1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-19 16:09:19 +03:00
nixpkgs/nixos/tests/web-servers/ttyd.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
940 B
Nix
Raw Normal View History

import ../make-test-python.nix (
{ lib, pkgs, ... }:
{
name = "ttyd";
meta.maintainers = with lib.maintainers; [ stunkymonkey ];
nodes.readonly =
{ pkgs, ... }:
{
services.ttyd = {
enable = true;
2024-01-31 17:59:39 +01:00
entrypoint = [ (lib.getExe pkgs.htop) ];
writeable = false;
};
};
nodes.writeable =
{ pkgs, ... }:
{
services.ttyd = {
enable = true;
username = "foo";
passwordFile = pkgs.writeText "password" "bar";
writeable = true;
};
};
testScript = ''
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"
'';
}
)