Skip to content
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

Write tests for MySQL user-deletion #445

Closed
rndmh3ro opened this issue Apr 28, 2021 · 1 comment · Fixed by #641
Closed

Write tests for MySQL user-deletion #445

rndmh3ro opened this issue Apr 28, 2021 · 1 comment · Fixed by #641

Comments

@rndmh3ro
Copy link
Member

Is your feature request related to a problem? Please describe.
We need to write some tests for the MySQL user-deletion tasks since we already got two bugs.

Describe the solution you'd like
They should be written with Ansible asserts and tested in the verify-step of molecule.
Tests (not complete):

  • user with password and without authentication string
  • user with password and authentication string
  • user with authentication string and without password
  • user with authentication string and password
  • user without authentication string and without password

Should be tested on different MySQL and MariaDB-versions (this should hopefully happen automatically with all tested operating systems:

  • MySQL < 5.7.6
  • MySQL > 5.7.6
  • MariaDB < 10.4
  • MariaDB > 10.4

Additional context
#444
#443

@schurzi schurzi linked a pull request Feb 24, 2023 that will close this issue
@schurzi
Copy link
Contributor

schurzi commented Feb 24, 2023

The Testcases are mostly implemented in the linked PR. But two of them are currently impossible to create:

  • user with password and without authentication string
  • user with authentication string and without password

This is because in current MariaDB versions the mysql.user table is a view linked to the mysql.global_privs table. So it is not possible to generate testing data with these versions. Also the view definition leaves no options to create these cases in any other way I can think of. The view in my test database is defined as:

select 
...
    if(
        json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'), 
        ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),
            ''
        ),
        ''
    ) AS `Password`,
    ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,
...
from `global_priv`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants