pgadmin4: fix tests

this commit passes the build dependencies to the
pgadmin nixos test for package and regression testing.

Also added changelog and some clarifying comments.

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2022-04-24 13:17:42 +02:00
parent e47b264592
commit 09a39cab40
2 changed files with 82 additions and 92 deletions

View File

@@ -1,4 +1,20 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: import ./make-test-python.nix ({ pkgs, lib, buildDeps ? [ ], ... }:
/*
This test suite replaces the typical pytestCheckHook function in python
packages. Pgadmin4 test suite needs a running and configured postgresql
server. This is why this test exists.
To not repeat all the python dependencies needed, this test is called directly
from the pgadmin4 derivation, which also passes the currently
used propagatedBuildInputs.
Unfortunately, there doesn't seem to be an easy way to otherwise include
the needed packages here.
Also any python Overrides need to be duplicated here, too.
*/
let let
pgadmin4SrcDir = "/pgadmin"; pgadmin4SrcDir = "/pgadmin";
@@ -47,50 +63,14 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
postgresql postgresql
chromedriver chromedriver
chromium chromium
# include the same packages as in pgadmin minus speaklater3
(python3.withPackages (python3.withPackages
(ps: with pythonPackages; [ (ps: buildDeps ++
selenium [
testtools # test suite package requirements
testscenarios pythonPackages.testscenarios
flask pythonPackages.selenium
flask-babelex ])
flask-babel
flask-gravatar
flask_login
flask_mail
flask_migrate
flask_sqlalchemy
flask_wtf
flask-compress
passlib
pytz
simplejson
six
sqlparse
wtforms
flask-paranoid
psutil
psycopg2
python-dateutil
sqlalchemy
itsdangerous
flask-security-too
bcrypt
cryptography
sshtunnel
ldap3
gssapi
flask-socketio
eventlet
httpagentparser
user-agents
wheel
authlib
qrcode
pillow
pyotp
boto3
])
) )
]; ];
services.postgresql = { services.postgresql = {

View File

@@ -1,17 +1,19 @@
{ stdenv { lib
, lib
, python3 , python3
, fetchurl , fetchurl
, zlib , zlib
, mkYarnModules , mkYarnModules
, sphinx , sphinx
, nixosTests , nixosTests
, pkgs
}: }:
let let
pname = "pgadmin"; pname = "pgadmin";
version = "6.8"; majorVersion = "6";
minorVersion = "8";
version = "${majorVersion}.${minorVersion}";
src = fetchurl { src = fetchurl {
url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz"; url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
@@ -26,6 +28,50 @@ let
yarnNix = ./yarn.nix; yarnNix = ./yarn.nix;
}; };
# move buildDeps here to easily pass to test suite
buildDeps = with pythonPackages; [
flask
flask-gravatar
flask_login
flask_mail
flask_migrate
flask_sqlalchemy
flask_wtf
flask-compress
passlib
pytz
simplejson
six
sqlparse
wtforms
flask-paranoid
psutil
psycopg2
python-dateutil
sqlalchemy
itsdangerous
flask-security-too
bcrypt
cryptography
sshtunnel
ldap3
flask-babelex
flask-babel
gssapi
flask-socketio
eventlet
httpagentparser
user-agents
wheel
authlib
qrcode
pillow
pyotp
botocore
boto3
];
# override necessary on pgadmin4 6.8
pythonPackages = python3.pkgs.overrideScope (final: prev: rec { pythonPackages = python3.pkgs.overrideScope (final: prev: rec {
flask = prev.flask.overridePythonAttrs (oldAttrs: rec { flask = prev.flask.overridePythonAttrs (oldAttrs: rec {
version = "2.0.3"; version = "2.0.3";
@@ -68,7 +114,7 @@ pythonPackages.buildPythonApplication rec {
postPatch = '' postPatch = ''
# patching Makefile, so it doesn't try to build sphinx documentation here # patching Makefile, so it doesn't try to build sphinx documentation here
# (will do so later) # (will do so later)
substituteInPlace Makefile --replace "LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $(MAKE) -C docs/en_US -f Makefile.sphinx html" "true" substituteInPlace Makefile --replace 'LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $(MAKE) -C docs/en_US -f Makefile.sphinx html' "true"
# fix document which refers a non-existing document and fails # fix document which refers a non-existing document and fails
substituteInPlace docs/en_US/contributions.rst --replace "code_snippets" "" substituteInPlace docs/en_US/contributions.rst --replace "code_snippets" ""
patchShebangs . patchShebangs .
@@ -137,57 +183,21 @@ pythonPackages.buildPythonApplication rec {
# checks will be run through nixos/tests # checks will be run through nixos/tests
doCheck = false; doCheck = false;
propagatedBuildInputs = with pythonPackages; [ # speaklater3 is seperate because when passing buildDeps
flask # to the test, it fails there due to a collision with speaklater
flask-gravatar propagatedBuildInputs = buildDeps ++ [pythonPackages.speaklater3];
flask_login
flask_mail
flask_migrate
flask_sqlalchemy
flask_wtf
flask-compress
passlib
pytz
simplejson
six
speaklater3
sqlparse
wtforms
flask-paranoid
psutil
psycopg2
python-dateutil
sqlalchemy
itsdangerous
flask-security-too
bcrypt
cryptography
sshtunnel
ldap3
flask-babelex
flask-babel
gssapi
flask-socketio
eventlet
httpagentparser
user-agents
wheel
authlib
qrcode
pillow
pyotp
botocore
boto3
];
passthru = { passthru.tests = {
tests = { inherit (nixosTests) pgadmin4 pgadmin4-standalone; }; standalone = nixosTests.pgadmin4-standalone;
# regression and function tests of the package itself
package = (import ../../../../nixos/tests/pgadmin4.nix ({ inherit pkgs; buildDeps = buildDeps; }));
}; };
meta = with lib; { meta = with lib; {
description = "Administration and development platform for PostgreSQL"; description = "Administration and development platform for PostgreSQL";
homepage = "https://www.pgadmin.org/"; homepage = "https://www.pgadmin.org/";
license = licenses.mit; license = licenses.mit;
changelog = "https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_${majorVersion}_${minorVersion}.html";
maintainers = with maintainers; [ gador ]; maintainers = with maintainers; [ gador ];
}; };
} }