nixosTests.pgadmin4: increase test coverage (#229632)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Florian 2023-05-15 17:04:22 +02:00 committed by GitHub
parent 7780f8c3cc
commit 391b059c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
imports = [ ./common/user-account.nix ];
environment.systemPackages = with pkgs; [
wget
curl
pgadmin4-desktopmode
];
@ -40,8 +41,10 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
with subtest("Check pgadmin module"):
machine.wait_for_unit("postgresql")
machine.wait_for_unit("pgadmin")
machine.wait_until_succeeds("curl -s localhost:5051")
machine.wait_until_succeeds("curl -s localhost:5051/login | grep \"<title>pgAdmin 4</title>\" > /dev/null")
machine.wait_until_succeeds("curl -sS localhost:5051")
machine.wait_until_succeeds("curl -sS localhost:5051/login | grep \"<title>pgAdmin 4</title>\" > /dev/null")
# 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
machine.succeed("wget -nv --level=1 --spider --recursive localhost:5051/login")
# pgadmin4 module saves the configuration to /etc/pgadmin/config_system.py
# pgadmin4-desktopmode tries to read that as well. This normally fails with a PermissionError, as the config file
@ -51,7 +54,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
# because of the wrong config for desktopmode.
with subtest("Check pgadmin standalone desktop mode"):
machine.execute("sudo -u alice pgadmin4 >&2 &", timeout=60)
machine.wait_until_succeeds("curl -s localhost:5050")
machine.wait_until_succeeds("curl -s localhost:5050/browser/ | grep \"<title>pgAdmin 4</title>\" > /dev/null")
machine.wait_until_succeeds("curl -sS localhost:5050")
machine.wait_until_succeeds("curl -sS localhost:5050/browser/ | grep \"<title>pgAdmin 4</title>\" > /dev/null")
machine.succeed("wget -nv --level=1 --spider --recursive localhost:5050/browser")
'';
})