From 9b28471da837c53e99c33bb8d472ee76f5001ab7 Mon Sep 17 00:00:00 2001 From: themadbit Date: Tue, 10 Mar 2026 15:33:17 +0300 Subject: [PATCH] holo-daemon-modular-service: add test --- nixos/tests/all-tests.nix | 1 + nixos/tests/holo-daemon-modular.nix | 66 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 nixos/tests/holo-daemon-modular.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index ef321d3af0bf..df8988d787fd 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -752,6 +752,7 @@ in hitch = handleTest ./hitch { }; hledger-web = runTest ./hledger-web.nix; hockeypuck = runTest ./hockeypuck.nix; + holo-daemon-modular-service = runTest ./holo-daemon-modular.nix; home-assistant = runTest ./home-assistant.nix; homebox = runTest ./homebox.nix; homebridge = runTest ./homebridge.nix; diff --git a/nixos/tests/holo-daemon-modular.nix b/nixos/tests/holo-daemon-modular.nix new file mode 100644 index 000000000000..af32d7e5d472 --- /dev/null +++ b/nixos/tests/holo-daemon-modular.nix @@ -0,0 +1,66 @@ +{ ... }: +{ + _class = "nixosTest"; + name = "holo-daemon-modular-service-test"; + + nodes = { + machine = + { pkgs, ... }: + { + environment.systemPackages = [ + pkgs.holo-daemon + pkgs.holo-cli + ]; + system.services.holo-daemon = { + imports = [ pkgs.holo-daemon.services.default ]; + }; + users.users.holo = { + isSystemUser = true; + group = "holo"; + home = "/var/lib/holo"; + createHome = true; + }; + users.groups.holo = { }; + services.getty.autologinUser = "root"; + }; + }; + + testScript = + { nodes, ... }: + '' + import time + + start_all() + + # holo-cli connects to the daemon at startup + # features a bash-like editing functionality for interactive use + # uses -c option to execute arguments as commands + + machine.wait_for_unit("multi-user.target") + + machine.wait_for_unit("holo-daemon.service") + + machine.succeed("holo-cli -V") + + # wait for cli to connect to the daemon + machine.wait_for_open_port(50051) + + # Test the running configuration is empty + machine.succeed("holo-cli -c 'show running format json'") + + # Configure an OSPFv3 instance: + # as seen in https://asciinema.org/a/qYxmDu1QjGPBAt5gNyNKvXhHk + + machine.send_chars("holo-cli\n", 1) + time.sleep(5) + machine.send_chars("configure\n", 1) + machine.send_chars("routing control-plane-protocols control-plane-protocol ietf-ospf:ospfv3 main\n", 1) + machine.send_chars("ospf preference inter-area 50\n", 1) + machine.send_chars("show changes\n", 1) + machine.send_chars("commit\n", 1) + machine.send_chars("exit\n", 1) + + # Verify the configuration was applied (in interactive test) + machine.succeed("test \"$(holo-cli -c 'show running format json')\" != \"{}\""); + ''; +}