Unverified Commit 391b059c authored by Florian's avatar Florian Committed by GitHub
Browse files

nixosTests.pgadmin4: increase test coverage (#229632)



Co-authored-by: default avatarSandro <sandro.jaeckel@gmail.com>
parent 7780f8c3
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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")
  '';
})