kittybox: { lib, ... }: { name = "nixos-kittybox"; nodes = { kittybox = { config, pkgs, lib, ... }: { imports = [ kittybox.nixosModules.default ]; services.kittybox = { enable = true; # It never actually contacts those endpoints anyway unless we use Micropub so it's fine! # TODO: Once we have self-hosted software for those endpoints, # make an e2e test for common workflows (e.g. making a post) tokenEndpoint = "https://example.com"; authorizationEndpoint = "https://example.com"; logLevel = "info,kittybox=debug,retainer::cache=warn,h2=warn,rustls=warn"; }; environment.systemPackages = with pkgs; [ xh ]; }; }; testScript = '' with subtest("Verify that Kittybox started correctly..."): kittybox.wait_for_open_port(8080) kittybox.succeed("xh --no-check-status http://localhost:8080/.kittybox/micropub") with subtest("Onboarding should correctly work..."): kittybox.copy_from_host("${./onboarding.json}", "/root/onboarding.json") kittybox.succeed("xh --follow http://localhost:8080/.kittybox/onboarding -j @/root/onboarding.json") # Testing for a known string is the easiest way to determine that the onboarding worked kittybox.succeed("xh http://localhost:8080/ | grep 'vestige of the past long gone'") ''; }