summaryrefslogtreecommitdiffstats
path: root/nixos/tests/sonic-server.nix
blob: 40f9802ec391eb90dc01aa4d831b3b41be3f2c79 (plain)
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
{ pkgs, lib, ... }:
{
  name = "sonic-server";

  meta = {
    maintainers = with lib.maintainers; [ anthonyroussel ];
  };

  nodes.machine =
    { pkgs, ... }:
    {
      services.sonic-server.enable = true;
    };

  testScript = ''
    machine.start()

    machine.wait_for_unit("sonic-server.service")
    machine.wait_for_open_port(1491)

    with subtest("Check control mode"):
      result = machine.succeed('(echo START control; sleep 1; echo PING; echo QUIT) | nc localhost 1491').splitlines()
      assert result[2] == "PONG", f"expected 'PONG', got '{result[2]}'"
  '';
}