1 import ./make-test-python.nix ({ pkgs, lib, ... }:
5 meta.maintainers = with lib.maintainers; [ mkg20001 gador ];
8 machine = { pkgs, ... }: {
10 imports = [ ./common/user-account.nix ];
12 environment.systemPackages = with pkgs; [
18 services.postgresql = {
21 host all all localhost trust
28 initialEmail = "bruh@localhost.de";
29 initialPasswordFile = pkgs.writeText "pw" "bruh2012!";
32 machine2 = { pkgs, ... }: {
34 imports = [ ./common/user-account.nix ];
36 services.postgresql = {
42 initialEmail = "bruh@localhost.de";
43 initialPasswordFile = pkgs.writeText "pw" "bruh2012!";
44 minimumPasswordLength = 12;
51 with subtest("Check pgadmin module"):
52 machine.wait_for_unit("postgresql")
53 machine.wait_for_unit("pgadmin")
54 machine.wait_until_succeeds("curl -sS localhost:5051")
55 machine.wait_until_succeeds("curl -sS localhost:5051/login | grep \"<title>pgAdmin 4</title>\" > /dev/null")
56 # check for missing support files (css, js etc). Should catch not-generated files during build. See e.g. https://github.com/NixOS/nixpkgs/pull/229184
57 machine.succeed("wget -nv --level=1 --spider --recursive localhost:5051/login")
59 machine.systemctl("restart pgadmin.service")
60 machine.wait_for_unit("pgadmin")
61 machine.wait_until_succeeds("curl -sS localhost:5051")
62 machine.wait_until_succeeds("curl -sS localhost:5051/login | grep \"<title>pgAdmin 4</title>\" > /dev/null")
64 # pgadmin4 module saves the configuration to /etc/pgadmin/config_system.py
65 # pgadmin4-desktopmode tries to read that as well. This normally fails with a PermissionError, as the config file
66 # is owned by the user of the pgadmin module. With the check-system-config-dir.patch this will just throw a warning
67 # but will continue and not read the file.
68 # If we run pgadmin4-desktopmode as root (something one really shouldn't do), it can read the config file and fail,
69 # because of the wrong config for desktopmode.
70 with subtest("Check pgadmin standalone desktop mode"):
71 machine.execute("sudo -u alice pgadmin4 >&2 &", timeout=60)
72 machine.wait_until_succeeds("curl -sS localhost:5050")
73 machine.wait_until_succeeds("curl -sS localhost:5050/browser/ | grep \"<title>pgAdmin 4</title>\" > /dev/null")
74 machine.succeed("wget -nv --level=1 --spider --recursive localhost:5050/browser")
76 with subtest("Check pgadmin minimum password length"):
77 machine2.wait_for_unit("postgresql")
78 machine2.wait_for_console_text("Password must be at least 12 characters long")