1{ pkgs, lib, ... }:
2{
3 name = "sonic-server";
4
5 meta = {
6 maintainers = with lib.maintainers; [ anthonyroussel ];
7 };
8
9 nodes.machine =
10 { pkgs, ... }:
11 {
12 services.sonic-server.enable = true;
13 };
14
15 testScript = ''
16 machine.start()
17
18 machine.wait_for_unit("sonic-server.service")
19 machine.wait_for_open_port(1491)
20
21 with subtest("Check control mode"):
22 result = machine.succeed('(echo START control; sleep 1; echo PING; echo QUIT) | nc localhost 1491').splitlines()
23 assert result[2] == "PONG", f"expected 'PONG', got '{result[2]}'"
24 '';
25}