1 import ./make-test-python.nix ({ lib, pkgs, ... }:
4 meta.maintainers = with lib.maintainers; [ azahi ];
8 services.endlessh-go = {
10 prometheus.enable = true;
15 unprivileged.configuration = {
16 services.endlessh-go = {
18 prometheus.port = 9229;
22 privileged.configuration = {
23 services.endlessh-go = {
31 client = { pkgs, ... }: {
32 environment.systemPackages = with pkgs; [ curl netcat ];
37 def activate_specialisation(name: str):
38 server.succeed(f"/run/booted-system/specialisation/{name}/bin/switch-to-configuration test >&2")
42 with subtest("Unprivileged"):
43 activate_specialisation("unprivileged")
44 server.wait_for_unit("endlessh-go.service")
45 server.wait_for_open_port(2222)
46 server.wait_for_open_port(9229)
47 client.succeed("nc -dvW5 server 2222")
48 client.succeed("curl -kv server:9229/metrics")
50 with subtest("Privileged"):
51 activate_specialisation("privileged")
52 server.wait_for_unit("endlessh-go.service")
53 server.wait_for_open_port(22)
54 server.wait_for_open_port(92)
55 client.succeed("nc -dvW5 server 22")
56 client.succeed("curl -kv server:92/metrics")