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