summaryrefslogtreecommitdiffstats
path: root/nixos/tests/matterjs-server.nix
blob: 229dd5edbd117d8e12242ccc73ddd342781649b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ lib, ... }:

{
  name = "matterjs-server";
  meta.maintainers = with lib.maintainers; [ kranzes ];

  nodes.machine.services.matterjs-server.enable = true;

  testScript =
    { nodes, ... }:
    let
      inherit (nodes.machine.services.matterjs-server) listenAddress port package;
    in
    ''
      import json

      machine.wait_for_unit("matterjs-server.service")
      machine.wait_for_open_port(${toString port})

      health = json.loads(machine.succeed("curl -fsS http://${listenAddress}:${toString port}/health"))
      assert health["version"] == "${package.version}"
    '';
}