[cypress] Using NPM Module 'pg' for 'postgres'#44084
Conversation
|
At the time I implemented Postgres into the system tests, there was a reason why I didn't use pg, but can't remember anymore. |
The dependencies? Or the MIT license? For functionality I will test - beside IPv6 - number of sessions, run time, Unix sockets ... |
|
It was something with the code. |
|
Drone reports JavaScript code style issues: https://ci.joomla.org/joomla/joomla-cms/78949/1/33 |
|
I have tested this item ✅ successfully on 7befd05 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44084. |
|
Can you rebase this one to 5.2? |
For Joomla 4.4-dev the same as 2e8dc3f Additionally updated to current 'pg' version 8.13.0
7befd05 to
f15590a
Compare
|
After rebase on 5.2-dev plus update to current All tests are passed ✅ |
|
Thanks for this fix. |
Last Edited: 24 September 2024: Finished Testing
Summary of Changes
Replace
postgreswithpgNPM module for Cypress System Tests:postgresNPM module.. Getting error e.g. "getaddrinfo ENOTFOUND fd00" using database host
fd00::6. No solvable in using
[fd00::6], getting error "getaddrinfo ENOTFOUND [fd00". looks like error is in how
postgresmodule uses nodepgis the official PostgreSQL client for Node.js, which is used ten times more frequently.👉 This change does not fix the rarely occurring PostgreSQL
duplicated keyserror as well. While this issue has been reduced by joomla-cms#43924, it still happens occasionally with usingpostgres, as well as withpgmodule.A side-effect of adding the new module is that the version is updated to 4.4.9 in the
package-lock.jsonfile.And
pghas more dependencies.Testing Instructions
One option for testing is using JBT >= 1.0.24 (which includes currently open joomla-projects/joomla-cypress#33, joomla-projects/joomla-cypress#36 and #43968):
scripts/test 44 system> duplicate key value violates unique constraint "jos44_users_pkey"docker exec jbt_44 ping jbt_pgbranch_44/cypress.config.mjsdb_host: 'fd00::5'scripts/test 44 system novnc install/Installation.cy.jsscripts/test 44 system novncpgand IPv6 addressdocker exec jbt_44 npm ciscripts/test 44 systempgand hostnamescripts/create 44 recreate pgsqlscripts/test 44 system> Postgres query failed: duplicate key value violates unique constraint "jos44_users_pkey"pg, IPv6 address and non-default port numbernpm installscripts/create 44 IPv6 pgsql https://github.com/muhme/joomla-cms:44-pg-for-postgressocatin Cypress container:docker exec jbt_cypress bash -c 'apt-get update && apt-get upgrade -y && apt-get install socat -y'docker exec jbt_44 ping jbt_cypress-> in my case fd00::8docker exec jbt_44 ping jbt_pg-> in my case fd00::6branch_44/cypress.config.mjsfd00::8and port4711separate and in Joomla backend configuration.php we are using combined[fd00::8]:4711docker exec jbt_cypress socat 'TCP6-LISTEN:4711,fork,reuseaddr' 'TCP6:[fd00::6]:5432'docker exec -it jbt_pg bash -c "PGPASSWORD=root psql -h fd00::8 -p 4711 -U root -d postgres"scripts/test 44 systempgin Cypress System Tests, Joomla PHP is still using database hostjbt_pgwith default port number (it would need [3.x] Allow to specify port number or UNIX socket in host option also for MySQL (PDO) and PostgreSQL (PDO) joomla-framework/database#310 - but as it is not focus with this PR, it is ignored)pg, IPv6 hostname and non-default port numberscripts/test 44 system👉 Be aware this test only covers the JS usage of
pgin Cypress System Tests. Joomla Web Installer is at this moment (September 2024) not able to set non-default port number for PostgreSQL (it needs [3.x] Allow to specify port number or UNIX socket in host option also for MySQL (PDO) and PostgreSQL (PDO) joomla-framework/database#310 - but as it is not focus with this PR, it is ignored). During System Tests Joomla PHP is still using database hostjbt_pgwith default port number.pg, IPv4 and using a hostname and default port number (the default case)scripts/create 44 pgsql https://github.com/muhme/joomla-cms:44-pg-for-postgresjbt_pganddb_portis emptyscripts/create)scripts/test 44 systempg, using a IPv4 address and non-standard port numberdocker exec jbt_cypress ping host.docker.internal-> 192.168.65.254 in my casecypress.config.mjsfile:db_host: '192.168.65.254'db_port: '7003'scripts/test 44 system install/Installation.cy.js novncscripts/test 44 systempg, using a IPv4 address and standard port numberdocker exec jbt_cypress ping jbt_pg-> 192.168.150.4 in my casecypress.config.mjsfile:db_host: '192.168.65.4'db_port: ''scripts/test 44 system install/Installation.cy.js novncscripts/test 44 systempgand using Unix socketpgmodule in this PR. Therefore, the changes from 44092 must be applied manually. You can use the atteched file db.mjs.txt to do this.scripts/create 44 pgsql socket https://github.com/muhme/joomla-cms:44-pg-for-postgresunix:/jbt/run/postgresql-socketcp db.mjs.txt branch_44/tests/System/plugins/db.mjsscripts/test 44 systemActual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed