Repository navigation
Derive MySQL host and port from {DB_HOST} in tests - #407
swissspidy wants to merge 1 commit into
Conversation
The parallel Docker workers of wp-cli-tests only receive
`WP_CLI_TEST_DBHOST`, not `MYSQL_HOST` and `MYSQL_TCP_PORT`, so
`{MYSQL_HOST}` and `{MYSQL_PORT}` stayed empty. The `DROP DATABASE`
step then failed silently and `install-wp-tests.sh` stopped at its
"reinstall?" prompt, and the `SHOW DATABASES` check failed with
"Unknown server host '-P'".
Use a small helper script that splits `{DB_HOST}` into host and port
(or socket) instead, and prefers the `mariadb` client when available.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWTd5pQ8Dw6arxXZ4GdZrc
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Fixes the failing
install-wp-tests.featurescenarios (e.g. https://github.com/wp-cli/scaffold-command/actions/runs/44215297421/job/134503641818).Cause
The parallel Docker workers in wp-cli-tests only pass
WP_CLI_TEST_DBHOST(127.0.0.1:3306) to the container. They don't passMYSQL_HOSTorMYSQL_TCP_PORT, so{MYSQL_HOST}and{MYSQL_PORT}were empty:mysql ... -h -P --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"failed quietly (it's anI trystep). The database was left over from an earlier scenario, soinstall-wp-tests.shstopped at its "Reinstalling will delete the existing test database" prompt and exited with 1.SHOW DATABASESchecks failed withUnknown server host '-P'.Fix
A small
mysql-client.shhelper splits{DB_HOST}into a host and a port, or a host and a socket. If themariadbclient is available, it uses that instead ofmysql, the same wayinstall-wp-tests.shdoes. It replaces every{MYSQL_HOST}/{MYSQL_PORT}usage ininstall-wp-tests.featureandscaffold-theme-tests.feature.Generated by Claude Code
Summary by CodeRabbit