This issue is automatically created based on existing pull request: #40943: Support a Unix-socket db-host in integration tests
Description (*)
Running the integration test suite against a MySQL/MariaDB server that listens only on a Unix socket does not work today, even though the application itself supports it (Magento\Framework\DB\Adapter\Pdo\Mysql::_connect() treats a db-host containing / as a socket path). Two things break:
-
Magento\TestFramework\Db\Mysql passes the configured db-host verbatim to the mysql/mariadb CLI tools as --host, always together with an explicit --port. A socket path is not a hostname, and an explicit --port makes MariaDB clients insist on TCP — so the setup DB dump (storeDbDump), cleanup() and restoreFromDbDump() all fail against a socket-only server. This PR makes those invocations use --socket= when db-host is a socket path, mirroring the PDO adapter's convention.
-
Magento\Framework\DB\Adapter\Pdo\Mysql::_connect() moves the socket path into $config['unix_socket'] and then unsets $config['host'] — the config mutation means any reconnect on the same adapter instance (closeConnection() + a later query, which several integration tests trigger) throws No host configured to connect. The fix keeps host = 'localhost' alongside unix_socket; mysqlnd routes that combination through the socket, and reconnects find a valid config.
Related Pull Requests
Fixed Issues (if relevant)
None filed.
Manual testing scenarios (*)
- Run MariaDB/MySQL listening on a Unix socket only (
skip-networking).
- Configure
dev/tests/integration/etc/install-config-mysql.php with 'db-host' => '/path/to/mysqld.sock'.
cd dev/tests/integration && ../../../vendor/bin/phpunit -c phpunit.xml.dist testsuite/Magento/Directory
- Before: bootstrap fails at the DB dump step (the CLI tool receives the socket path as
--host), and — if that is worked around — tests that reconnect fail with No host configured to connect. After: the suite passes (verified against MariaDB 11.4: 246 tests, 464 assertions, 0 failures).
Questions or comments
The host:port branch of the same config mutation has the equivalent reconnect problem (Port must be configured within host parameter on re-entry); this PR deliberately only fixes the socket lane to stay minimal, but I'm happy to extend it.
Contribution checklist (*)
This issue is automatically created based on existing pull request: #40943: Support a Unix-socket db-host in integration tests
Description (*)
Running the integration test suite against a MySQL/MariaDB server that listens only on a Unix socket does not work today, even though the application itself supports it (
Magento\Framework\DB\Adapter\Pdo\Mysql::_connect()treats adb-hostcontaining/as a socket path). Two things break:Magento\TestFramework\Db\Mysqlpasses the configureddb-hostverbatim to themysql/mariadbCLI tools as--host, always together with an explicit--port. A socket path is not a hostname, and an explicit--portmakes MariaDB clients insist on TCP — so the setup DB dump (storeDbDump),cleanup()andrestoreFromDbDump()all fail against a socket-only server. This PR makes those invocations use--socket=whendb-hostis a socket path, mirroring the PDO adapter's convention.Magento\Framework\DB\Adapter\Pdo\Mysql::_connect()moves the socket path into$config['unix_socket']and thenunsets$config['host']— the config mutation means any reconnect on the same adapter instance (closeConnection()+ a later query, which several integration tests trigger) throwsNo host configured to connect. The fix keepshost = 'localhost'alongsideunix_socket; mysqlnd routes that combination through the socket, and reconnects find a valid config.Related Pull Requests
Fixed Issues (if relevant)
None filed.
Manual testing scenarios (*)
skip-networking).dev/tests/integration/etc/install-config-mysql.phpwith'db-host' => '/path/to/mysqld.sock'.cd dev/tests/integration && ../../../vendor/bin/phpunit -c phpunit.xml.dist testsuite/Magento/Directory--host), and — if that is worked around — tests that reconnect fail withNo host configured to connect. After: the suite passes (verified against MariaDB 11.4: 246 tests, 464 assertions, 0 failures).Questions or comments
The
host:portbranch of the same config mutation has the equivalent reconnect problem (Port must be configured within host parameteron re-entry); this PR deliberately only fixes the socket lane to stay minimal, but I'm happy to extend it.Contribution checklist (*)