Unit/System Tests PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar muhme
muhme
16 Sep 2024

Summary of Changes

Currently, Unix sockets do not work in Cypress System Tests. This enhancement is aimed at enabling their functionality.

See backend | Global Configuration | Server Database:
screen

Check if db_host is a Unix socket by verifying the unix:/ prefix. All JavaScript drivers does not handle this prefix, it needs to be stripped. This approach maintains compatibility with the PHP drivers and allows to have Cypress.config.mjs working for installation step (PHP driver) and custom database commands (JavaScript driver).

This change has already been tested with the NPM module pg replacment from #44084.

Testing Instructions

One option for testing is using JBT >= 1.0.24, as described here. Doing installation with MariaDB and MySQLi driver, test one spec with database custom commands. Installation step is already executed == tested with scripts/created or scripts/database. Watching progress and errors with noVNC:

scripts/create 44 mariadbi socket
scripts/test 44 system novnc administrator/components/com_users/Users.cy.js 

Repeat for the other four database variants:

foreach variant in "mysqli" "mysql" "mariadb" "pgsql"; do
  scripts/database 44 $variant socket
  scripts/test 44 system novnc administrator/components/com_users/Users.cy.js 
done

Install Joomla Patch Tester and "Apply Patch" 44092 in backend

scripts/patchtester 

And repeat the tests:

foreach variant in "mariadbi"  "mysqli" "mysql" "mariadb" "pgsql"; do
  scripts/database 44 $variant socket
  scripts/test 44 system novnc administrator/components/com_users/Users.cy.js 
done

Final run overall System Tests suite for one database variant:

scripts/test 44 system

Actual result BEFORE applying this Pull Request

The administrator/components/com_users/Users.cy.js 4 of the 6 tests fail with e.g.
getaddrinfo ENOTFOUND unix:/jbt/run/mariadb-socket/mysqld.sock

Expected result AFTER applying this Pull Request

Installation step and System Tests with custom database commands work for all database variants.

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

avatar muhme muhme - open - 16 Sep 2024
avatar muhme muhme - change - 16 Sep 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Sep 2024
Category JavaScript Unit Tests
avatar richard67
richard67 - comment - 16 Sep 2024

Drone reports JavaScript code style issues: https://ci.joomla.org/joomla/joomla-cms/78953/1/33

avatar muhme
muhme - comment - 16 Sep 2024

Thank you for notice 👍 and I am wondering that Drone is running on DRAFT PR

avatar richard67
richard67 - comment - 16 Sep 2024

Yes, no difference between draft and not draft for ci tests.

avatar muhme muhme - change - 17 Sep 2024
Labels Added: Unit/System Tests PR-4.4-dev
avatar muhme muhme - change - 17 Sep 2024
The description was changed
avatar muhme muhme - edited - 17 Sep 2024
avatar muhme muhme - change - 17 Sep 2024
Title
[cypress] Sockets for system tests
[cypress] Database Unix Sockets for System Tests
avatar muhme muhme - edited - 17 Sep 2024
avatar alikon alikon - test_item - 28 Sep 2024 - Tested successfully
avatar alikon
alikon - comment - 28 Sep 2024

I have tested this item ✅ successfully on ce35190


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44092.

avatar laoneo
laoneo - comment - 20 Oct 2024

Can you rebase this one to 5.2?

avatar joomla-cms-bot joomla-cms-bot - change - 22 Oct 2024
Category JavaScript Unit Tests Unit Tests Repository Administration com_admin SQL
avatar muhme
muhme - comment - 22 Oct 2024

Rebased to 5.2-dev and tested on macOS with mariadbi using Unix sockets in creating instance from PR branch:

scripts/create 52 socket https://github.com/muhme/joomla-cms:sockets-for-system-tests
scripts/test 52 system

Used as db_host is unix:/var/run/mariadb-socket/mysqld.sock. System Tests are passed succesfully. ✅

avatar laoneo laoneo - change - 23 Oct 2024
Labels Added: PR-5.2-dev
Removed: PR-4.4-dev
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2024
Category Unit Tests Repository Administration com_admin SQL JavaScript Unit Tests
avatar laoneo
laoneo - comment - 23 Oct 2024

Can you fix the conflicts?

avatar muhme
muhme - comment - 23 Oct 2024

Fixed the merge conflicts and tested again, this time with PostgreSQL Unix sockets and using the new pg NPM module:

scripts/create 52 pgsql socket https://github.com/muhme/joomla-cms:sockets-for-system-tests
scripts/test 52 system

Verified pg is used in branch_52/tests/System/plugins/db.mjs and db_host is set asunix:/var/run/postgresql-socket. System Tests are passed succesfully. ✅

avatar laoneo laoneo - change - 24 Oct 2024
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-10-24 05:34:57
Closed_By laoneo
avatar laoneo laoneo - close - 24 Oct 2024
avatar laoneo laoneo - merge - 24 Oct 2024
avatar laoneo
laoneo - comment - 24 Oct 2024

Thanks!

Add a Comment

Login with GitHub to post a comment