nixpkgs/nixos/tests/sonic-server.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
585 B
Nix
Raw Permalink Normal View History

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