-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
postgres
withpg
NPM module for Cypress System Tests:postgres
NPM 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
postgres
module uses nodepg
is the official PostgreSQL client for Node.js, which is used ten times more frequently.👉 This change does not fix the rarely occurring PostgreSQL
duplicated keys
error as well. While this issue has been reduced by joomla-cms#43924, it still happens occasionally with usingpostgres
, as well as withpg
module.A side-effect of adding the new module is that the version is updated to 4.4.9 in the
package-lock.json
file.And
pg
has 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_pg
branch_44/cypress.config.mjs
db_host: 'fd00::5'
scripts/test 44 system novnc install/Installation.cy.js
scripts/test 44 system novnc
pg
and IPv6 addressdocker exec jbt_44 npm ci
scripts/test 44 system
pg
and hostnamescripts/create 44 recreate pgsql
scripts/test 44 system
> Postgres query failed: duplicate key value violates unique constraint "jos44_users_pkey"
pg
, IPv6 address and non-default port numbernpm install
scripts/create 44 IPv6 pgsql https://github.com/muhme/joomla-cms:44-pg-for-postgres
socat
in 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.mjs
fd00::8
and port4711
separate and in Joomla backend configuration.php we are using combined[fd00::8]:4711
docker 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 system
pg
in Cypress System Tests, Joomla PHP is still using database hostjbt_pg
with 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
pg
in 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_pg
with 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-postgres
jbt_pg
anddb_port
is emptyscripts/create
)scripts/test 44 system
pg
, using a IPv4 address and non-standard port numberdocker exec jbt_cypress ping host.docker.internal
-> 192.168.65.254 in my casecypress.config.mjs
file:db_host: '192.168.65.254'
db_port: '7003'
scripts/test 44 system install/Installation.cy.js novnc
scripts/test 44 system
pg
, using a IPv4 address and standard port numberdocker exec jbt_cypress ping jbt_pg
-> 192.168.150.4 in my casecypress.config.mjs
file:db_host: '192.168.65.4'
db_port: ''
scripts/test 44 system install/Installation.cy.js novnc
scripts/test 44 system
pg
and using Unix socketpg
module 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-postgres
unix:/jbt/run/postgresql-socket
cp db.mjs.txt branch_44/tests/System/plugins/db.mjs
scripts/test 44 system
Actual 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