-
Notifications
You must be signed in to change notification settings - Fork 89
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
mysql_user: refactor to reduce execute() calls #76
mysql_user: refactor to reduce execute() calls #76
Conversation
051df16
to
e3a91cb
Compare
Codecov Report
@@ Coverage Diff @@
## main #76 +/- ##
==========================================
+ Coverage 75.01% 75.07% +0.06%
==========================================
Files 12 12
Lines 1641 1645 +4
Branches 423 423
==========================================
+ Hits 1231 1235 +4
Misses 267 267
Partials 143 143
Continue to review full report at Codecov.
|
This module does not currently log the SQL statements that it executes. A change was proposed to add this functionality, but it would require modifications in many sections of the code due to how many cursor.execute() statements there currently are. This change simply consolidates the number of execute() calls where it is trivial to do so.
e3a91cb
to
9900b11
Compare
It doesn't look like the plugin parameters had any testing. The I'm assuming that I'll hit this issue in #75 even without refactoring due to the number of plugin-related branches. I'm not very familiar with other auth plugins, but I can take a look at what it'd take to fix the |
from my personal experience: we should cover all changed parts:), i.e. to keep CI green |
The purpose of this change was originally to expand test coverage to unblock ansible-collections#76, but an issue was detected with the encrypted parameter on MySQL 8.0 in the process of writing the tests. Additionally, user_password_update_test.yml had been disabled at some point, so I opted to replace it with two new files that will focus on the password and plugin auth paths.
The purpose of this change was originally to expand test coverage to unblock ansible-collections#76, but an issue was detected with the encrypted parameter on MySQL 8.0 in the process of writing the tests. Additionally, user_password_update_test.yml had been disabled at some point, so I opted to replace it with two new files that will focus on the password and plugin auth paths.
I believe this should be unblocked as soon as #79 is merged. That PR adds test coverage that was missing for the majority of password and plugin authentication paths. |
* mysql_user: fixed encrypted option for MySQL 8.0 and test coverage The purpose of this change was originally to expand test coverage to unblock #76, but an issue was detected with the encrypted parameter on MySQL 8.0 in the process of writing the tests. Additionally, user_password_update_test.yml had been disabled at some point, so I opted to replace it with two new files that will focus on the password and plugin auth paths. * Updated tests to cover a couple of missing branches * Skip tests that rely on sha256_password if pymysql < 0.9 * Cover the case where pymysql isn't installed for plugin tests * Added better plugin auth checking to tests and other minor changes * Fixed version detection to explicitly handle MariaDB * Removed unneeded import from previous change * Remove whitespace that was introduced by change that was removed * Added unit tests for missing coverage
@steveteahan could you please rebase the branch and fix the conflicts |
… into mysql-user-query-refact
@steveteahan if the tests get green, will try to review the PR tomorrow (if nothing super urgent on my day work), thanks for working on this |
@bmalynovytch what do you think? It's a kinda preparation for #75 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmalynovytch what do you think? It's a kinda preparation for #75
Looks good to me, although I didn't test it.
@steveteahan thanks for the refactoring! |
SUMMARY
This module does not currently log the SQL statements that it executes.
A change was proposed to add this functionality, but it would require
modifications in many sections of the code due to how many cursor.execute()
statements there currently are. This change simply consolidates the
number of execute() calls where it is trivial to do so.
ISSUE TYPE
COMPONENT NAME
mysql_user
ADDITIONAL INFORMATION
Without this change, logging the queries in my change proposed in #75 would either look like:
or
Overall, even if I were to create a
execute_and_log
method, the proposed changes would still be an improvement in readability.