about summary refs log tree commit diff
path: root/nixos/tests/mollysocket.nix
blob: 8cbd0c0272e09fb873802b564c961b9a58020769 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import ./make-test-python.nix ({ pkgs, lib, ... }:

let
  port = 1234;
in {
  name = "mollysocket";
  meta.maintainers = with lib.maintainers; [ dotlambda ];

  nodes.mollysocket = { ... }: {
    services.mollysocket = {
      enable = true;
      settings = {
        inherit port;
      };
    };
  };

  testScript = ''
    import json

    mollysocket.wait_for_unit("mollysocket.service")
    mollysocket.wait_for_open_port(${toString port})

    out = mollysocket.succeed("curl --fail http://127.0.0.1:${toString port}")
    assert json.loads(out)["mollysocket"]["version"] == "${toString pkgs.mollysocket.version}"
  '';
})