-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add support for MySQL socket connection #171
Conversation
I'm unsure how to test the However, as soon as the format passes the |
Can we add a functional test for this? |
Different OSes use different paths but file check should succeed for 'unix://path/mysql.sock' or 'localhost://path/mysql.sock' too or you can use realpath() function to get the actual path to the file which would be the same in this case, on mac localhost one should work since that's supposed to point to device itself |
@danielbachhuber I've added one, but I couldn't make it work on GH environments, so I added Do you think it's enough? I couldn't quickly figure out how we could use MySQL with a socket connection during GH action. |
@wojtekn At the very least, you can try to run the command without the |
@wp-cli/committers 976b7c6 passes for me locally, but then fails in the container. What do you think we should do? I think I'd be fine adding a |
@danielbachhuber why not try the proper sock path |
@aonsyed I'm not sure I follow. Can you show me with a diff? I'm using |
@danielbachhuber Looking at tast failures |
@danielbachhuber definitely it can change but it seems that docker environement for testing is pretty standard debian based linux for all the MySQL version from 5.3 to 8.0 in the your test environment and the socket path is always The best solution for a controlled testing would be to change this in parameters Basically use the previous test method instead of getting socket path from variable and use |
@danielbachhuber the issue lies with
Alternatively, you can change the test like this
Alternatively, some other way to drop |
@wojtekn This test won't work since |
@aonsyed, thanks, I will check those. In the meantime, I found out that my original implementation was not correct - it was accepting a socket file path, e.g., |
When trying to configure db socket connection:
Returns: Socket connections expressed as |
The tests pass fine locally 😭
My guess is that the tests are finding a socket in GitHub Actions, but the socket doesn't correlate to the MySQL test database. I don't have any great ideas to work around this. |
@danielbachhuber @swissspidy FYI: I finally got this to work, but in order to do so, I had to rethink the way the database is handled in GHA. We previously had a GHA service with a MySQL image running. It turned out that this did not actually work as intended, as there was confusion between the MySQL server bundled with the Ubuntu OS and the one from the service. They were using the same name, and the "DB start" action we had was actually starting the Ubuntu-bundled one, as the other was already running. The system I'm using now does not use a GHA service, but rather uses an action that downloads the MySQL server and then launches it. This has the following impact:
|
Thanks for solving it @schlessera !
This is a great outcome 👍 |
Awesome! Thanks @schlessera 😊 |
Related wp-cli/wp-cli#5859
In this diff, I propose to add support for MySQL socket connection to the
wp config create
command.I used the approach proposed by @aonsyed under #169
Testing steps:
wp-config.php
file was created and confirm that it has a socket configured in place of dbhost