{ lib, pkgs, bambuddy, nixosModule, }: # Integration test: boots two NixOS VMs with the bambuddy NixOS module. # # * `server` uses the default configuration (port 8000, firewall open) and # checks that the service starts, the API responds, the prebuilt React # frontend is served with its static assets, and persistent state # (SQLite database, logs) lands in the StateDirectory. # * `custom` exercises the module options (custom host/port, extra # environment) and verifies the dashboard is reachable cross-node once # the firewall is opened. pkgs.testers.runNixOSTest ( { ... }: { name = "bambuddy-service"; nodes = { server = { pkgs, ... }: { imports = [ nixosModule ]; services.bambuddy = { enable = true; openFirewall = true; }; environment.systemPackages = [ pkgs.curl ]; }; custom = { pkgs, ... }: { imports = [ nixosModule ]; services.bambuddy = { enable = true; host = "127.0.0.1"; port = 8123; environment.LOG_LEVEL = "DEBUG"; }; environment.systemPackages = with pkgs; [ curl iproute2 ]; }; }; testScript = '' server.start() custom.start() server.wait_for_unit("bambuddy.service") server.wait_for_open_port(8000) with subtest("health endpoint responds"): server.succeed("curl -fsS http://127.0.0.1:8000/health | grep -q healthy") with subtest("uvicorn started cleanly"): server.succeed( "journalctl -u bambuddy.service --no-pager | grep -q 'Application startup complete'" ) with subtest("web UI is served from the packaged static build"): server.succeed("curl -fsS http://127.0.0.1:8000/ | grep -q '