diff options
author | Yureka <yuka@yuka.dev> | 2022-12-01 17:32:15 +0100 |
---|---|---|
committer | Yureka <yuka@yuka.dev> | 2022-12-07 12:54:55 +0100 |
commit | a0e889791f5e225abc156d16ce172712caeaf247 (patch) | |
tree | 29f5c356fee16078e2a2726b97704db69faa5cc6 /nixos/tests/web-apps | |
parent | 56d4e1ec67dfe197940da6775ed256365532d77d (diff) |
nixos/tests/peering-manager: init
Diffstat (limited to 'nixos/tests/web-apps')
-rw-r--r-- | nixos/tests/web-apps/peering-manager.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/nixos/tests/web-apps/peering-manager.nix b/nixos/tests/web-apps/peering-manager.nix new file mode 100644 index 0000000000000..56b7eebfadffd --- /dev/null +++ b/nixos/tests/web-apps/peering-manager.nix @@ -0,0 +1,40 @@ +import ../make-test-python.nix ({ lib, pkgs, ... }: { + name = "peering-manager"; + + meta = with lib.maintainers; { + maintainers = [ yuka ]; + }; + + nodes.machine = { ... }: { + services.peering-manager = { + enable = true; + secretKeyFile = pkgs.writeText "secret" '' + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + ''; + }; + }; + + testScript = { nodes }: '' + machine.start() + machine.wait_for_unit("peering-manager.target") + machine.wait_until_succeeds("journalctl --since -1m --unit peering-manager --grep Listening") + + print(machine.succeed( + "curl -sSfL http://[::1]:8001" + )) + with subtest("Home screen loads"): + machine.succeed( + "curl -sSfL http://[::1]:8001 | grep '<title>Home - Peering Manager</title>'" + ) + with subtest("checks succeed"): + machine.succeed( + "systemctl stop peering-manager peering-manager-rq" + ) + machine.succeed( + "sudo -u postgres psql -c 'ALTER USER \"peering-manager\" WITH SUPERUSER;'" + ) + machine.succeed( + "cd ${nodes.machine.config.system.build.peeringManagerPkg}/opt/peering-manager ; peering-manager-manage test --no-input" + ) + ''; +}) |