From eff62ac1963df80205482aa6d40962f1abdfa832 Mon Sep 17 00:00:00 2001 From: Florian Brandes Date: Wed, 20 Apr 2022 00:45:38 +0200 Subject: pgadmin4: make regression test use the same packages Signed-off-by: Florian Brandes --- nixos/tests/pgadmin4.nix | 125 +++++++++++++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 47 deletions(-) (limited to 'nixos') diff --git a/nixos/tests/pgadmin4.nix b/nixos/tests/pgadmin4.nix index 2f6dc3bd569ff..dd4be1d0616c1 100644 --- a/nixos/tests/pgadmin4.nix +++ b/nixos/tests/pgadmin4.nix @@ -5,49 +5,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: pgadmin4Dir = "/var/lib/pgadmin"; pgadmin4LogDir = "/var/log/pgadmin"; - python-with-needed-packages = pkgs.python3.withPackages (ps: with ps; [ - 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 - ]); in { name = "pgadmin4"; @@ -55,12 +12,86 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: nodes.machine = { pkgs, ... }: { imports = [ ./common/x11.nix ]; + # needed because pgadmin 6.8 will fail, if those dependencies get updated + nixpkgs.overlays = [ + (self: super: { + pythonPackages = super.python3.pkgs.overrideScope (final: prev: rec { + + flask = prev.flask.overridePythonAttrs (oldAttrs: rec { + version = "2.0.3"; + src = oldAttrs.src.override { + inherit version; + sha256 = "sha256-4RIMIoyi9VO0cN9KX6knq2YlhGdSYGmYGz6wqRkCaH0="; + }; + disabledTests = (oldAttrs.disabledTests or [ ]) ++ [ + "test_aborting" + ]; + }); + flask-paranoid = prev.flask-paranoid.overridePythonAttrs (oldAttrs: rec { + # Nothing of interest changed from 0.2 to 0.3 + doCheck = false; + }); + werkzeug = prev.werkzeug.overridePythonAttrs (oldAttrs: rec { + version = "2.0.3"; + src = oldAttrs.src.override { + inherit version; + sha256 = "sha256-uGP4/wV8UiFktgZ8niiwQRYbS+W6TQ2s7qpQoWOCLTw="; + }; + }); + }); + }) + ]; + environment.systemPackages = with pkgs; [ pgadmin4 postgresql - python-with-needed-packages chromedriver chromium + (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 + ]) + ) ]; services.postgresql = { enable = true; @@ -121,7 +152,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: with subtest("run browser test"): machine.succeed( 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \ - && ${python-with-needed-packages.interpreter} regression/runtests.py --pkg browser --exclude \ + && python regression/runtests.py --pkg browser --exclude \ browser.tests.test_ldap_login.LDAPLoginTestCase,browser.tests.test_ldap_login' ) @@ -131,13 +162,13 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: machine.succeed( 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \ && export FONTCONFIG_FILE=${pkgs.makeFontsConf { fontDirectories = [];}} \ - && ${python-with-needed-packages.interpreter} regression/runtests.py --pkg feature_tests' + && python regression/runtests.py --pkg feature_tests' ) with subtest("run resql test"): machine.succeed( 'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \ - && ${python-with-needed-packages.interpreter} regression/runtests.py --pkg resql' + && python regression/runtests.py --pkg resql' ) ''; }) -- cgit 1.4.1 From eef222b8c2f220033fb76aa64cdfd9dcf9d6a3aa Mon Sep 17 00:00:00 2001 From: Florian Brandes Date: Sun, 24 Apr 2022 13:17:42 +0200 Subject: 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 --- nixos/tests/pgadmin4.nix | 68 ++++++++-------------- pkgs/tools/admin/pgadmin/default.nix | 106 +++++++++++++++++++---------------- 2 files changed, 82 insertions(+), 92 deletions(-) (limited to 'nixos') diff --git a/nixos/tests/pgadmin4.nix b/nixos/tests/pgadmin4.nix index dd4be1d0616c1..6c37bc0502f37 100644 --- a/nixos/tests/pgadmin4.nix +++ b/nixos/tests/pgadmin4.nix @@ -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 = { diff --git a/pkgs/tools/admin/pgadmin/default.nix b/pkgs/tools/admin/pgadmin/default.nix index 77cfff9aa3992..8b40687ec0b3f 100644 --- a/pkgs/tools/admin/pgadmin/default.nix +++ b/pkgs/tools/admin/pgadmin/default.nix @@ -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 ]; }; } -- cgit 1.4.1 From 709cc7066b631ebc7b97d7213385045985e6e6c9 Mon Sep 17 00:00:00 2001 From: Florian Brandes Date: Thu, 28 Apr 2022 15:03:31 +0200 Subject: pgadmin4: pass pythonEnv as variable Signed-off-by: Florian Brandes --- nixos/tests/pgadmin4.nix | 32 +++++--------------------------- pkgs/tools/admin/pgadmin/default.nix | 2 +- 2 files changed, 6 insertions(+), 28 deletions(-) (limited to 'nixos') diff --git a/nixos/tests/pgadmin4.nix b/nixos/tests/pgadmin4.nix index 6c37bc0502f37..b30299d307eb9 100644 --- a/nixos/tests/pgadmin4.nix +++ b/nixos/tests/pgadmin4.nix @@ -1,4 +1,4 @@ -import ./make-test-python.nix ({ pkgs, lib, buildDeps ? [ ], ... }: +import ./make-test-python.nix ({ pkgs, lib, buildDeps ? [ ], pythonEnv ? [ ], ... }: /* This test suite replaces the typical pytestCheckHook function in python @@ -7,12 +7,13 @@ import ./make-test-python.nix ({ pkgs, lib, buildDeps ? [ ], ... }: To not repeat all the python dependencies needed, this test is called directly from the pgadmin4 derivation, which also passes the currently - used propagatedBuildInputs. + used propagatedBuildInputs and any python overrides. 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. + Due the the needed parameters a direct call to "nixosTests.pgadmin4" fails + and needs to be called as "pgadmin4.tests" */ @@ -31,30 +32,7 @@ import ./make-test-python.nix ({ pkgs, lib, buildDeps ? [ ], ... }: # needed because pgadmin 6.8 will fail, if those dependencies get updated nixpkgs.overlays = [ (self: super: { - pythonPackages = super.python3.pkgs.overrideScope (final: prev: rec { - - flask = prev.flask.overridePythonAttrs (oldAttrs: rec { - version = "2.0.3"; - src = oldAttrs.src.override { - inherit version; - sha256 = "sha256-4RIMIoyi9VO0cN9KX6knq2YlhGdSYGmYGz6wqRkCaH0="; - }; - disabledTests = (oldAttrs.disabledTests or [ ]) ++ [ - "test_aborting" - ]; - }); - flask-paranoid = prev.flask-paranoid.overridePythonAttrs (oldAttrs: rec { - # Nothing of interest changed from 0.2 to 0.3 - doCheck = false; - }); - werkzeug = prev.werkzeug.overridePythonAttrs (oldAttrs: rec { - version = "2.0.3"; - src = oldAttrs.src.override { - inherit version; - sha256 = "sha256-uGP4/wV8UiFktgZ8niiwQRYbS+W6TQ2s7qpQoWOCLTw="; - }; - }); - }); + pythonPackages = pythonEnv; }) ]; diff --git a/pkgs/tools/admin/pgadmin/default.nix b/pkgs/tools/admin/pgadmin/default.nix index ac3af0c1edf91..974ec1cd00ef3 100644 --- a/pkgs/tools/admin/pgadmin/default.nix +++ b/pkgs/tools/admin/pgadmin/default.nix @@ -188,7 +188,7 @@ pythonPackages.buildPythonApplication rec { passthru.tests = { standalone = nixosTests.pgadmin4-standalone; # regression and function tests of the package itself - package = (import ../../../../nixos/tests/pgadmin4.nix ({ inherit pkgs; buildDeps = buildDeps; })); + package = (import ../../../../nixos/tests/pgadmin4.nix ({ inherit pkgs; buildDeps = buildDeps; pythonEnv = pythonPackages; })); }; meta = with lib; { -- cgit 1.4.1