python312Packages.dissect-extfs: 3.11 -> 3.12
[NixPkgs.git] / nixos / tests / pgmanage.nix
blob6e72b32eca369900b643a0230c8b8de841ef1208
1 import ./make-test-python.nix ({ pkgs, ... } :
2 let
3   role     = "test";
4   password = "secret";
5   conn     = "local";
6 in
8   name = "pgmanage";
9   meta = with pkgs.lib.maintainers; {
10     maintainers = [ basvandijk ];
11   };
12   nodes = {
13     one = { config, pkgs, ... }: {
14       services = {
15         postgresql = {
16           enable = true;
17           initialScript = pkgs.writeText "pg-init-script" ''
18             CREATE ROLE ${role} SUPERUSER LOGIN PASSWORD '${password}';
19           '';
20         };
21         pgmanage = {
22           enable = true;
23           connections = {
24             ${conn} = "hostaddr=127.0.0.1 port=${toString config.services.postgresql.settings.port} dbname=postgres";
25           };
26         };
27       };
28     };
29   };
31   testScript = ''
32     start_all()
33     one.wait_for_unit("default.target")
34     one.require_unit_state("pgmanage.service", "active")
36     # Test if we can log in.
37     one.wait_until_succeeds(
38         "curl 'http://localhost:8080/pgmanage/auth' --data 'action=login&connname=${conn}&username=${role}&password=${password}' --fail"
39     )
40   '';