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:
Florian Brandes 2022-04-24 13:17:42 +02:00
parent eff62ac196
commit eef222b8c2
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
pgadmin4SrcDir = "/pgadmin";
@ -47,50 +63,14 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
postgresql
chromedriver
chromium
# include the same packages as in pgadmin minus speaklater3
(python3.withPackages
(ps: with pythonPackages; [
selenium
testtools
testscenarios
flask
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
])
(ps: buildDeps ++
[
# test suite package requirements
pythonPackages.testscenarios
pythonPackages.selenium
])
)
];
services.postgresql = {

View File

@ -1,17 +1,19 @@
{ stdenv
, lib
{ lib
, python3
, fetchurl
, zlib
, mkYarnModules
, sphinx
, nixosTests
, pkgs
}:
let
pname = "pgadmin";
version = "6.8";
majorVersion = "6";
minorVersion = "8";
version = "${majorVersion}.${minorVersion}";
src = fetchurl {
url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
@ -26,6 +28,50 @@ let
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 {
flask = prev.flask.overridePythonAttrs (oldAttrs: rec {
version = "2.0.3";
@ -68,7 +114,7 @@ pythonPackages.buildPythonApplication rec {
postPatch = ''
# patching Makefile, so it doesn't try to build sphinx documentation here
# (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
substituteInPlace docs/en_US/contributions.rst --replace "code_snippets" ""
patchShebangs .
@ -137,57 +183,21 @@ pythonPackages.buildPythonApplication rec {
# checks will be run through nixos/tests
doCheck = false;
propagatedBuildInputs = with pythonPackages; [
flask
flask-gravatar
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
];
# speaklater3 is seperate because when passing buildDeps
# to the test, it fails there due to a collision with speaklater
propagatedBuildInputs = buildDeps ++ [pythonPackages.speaklater3];
passthru = {
tests = { inherit (nixosTests) pgadmin4 pgadmin4-standalone; };
passthru.tests = {
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; {
description = "Administration and development platform for PostgreSQL";
homepage = "https://www.pgadmin.org/";
license = licenses.mit;
changelog = "https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_${majorVersion}_${minorVersion}.html";
maintainers = with maintainers; [ gador ];
};
}