nixpkgs/nixos/tests/sonic-server.nix

28 lines
659 B
Nix
Raw Normal View History

import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "sonic-server";
2023-11-10 13:52:15 +00:00
meta = {
maintainers = with lib.maintainers; [ anthonyroussel ];
};
2023-11-10 13:52:15 +00:00
nodes.machine =
{ pkgs, ... }:
{
services.sonic-server.enable = true;
};
2023-11-10 13:52:15 +00:00
testScript = ''
machine.start()
2023-11-10 13:52:15 +00:00
machine.wait_for_unit("sonic-server.service")
machine.wait_for_open_port(1491)
2023-11-10 13:52:15 +00:00
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]}'"
'';
}
)