mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-25 11:51:27 -07:00
Using show all slaves status
when using MariaDB to be consistent with MySQL (#602)
* Using `show all slaves status` whe using MariaDB to be consistent with the MySQL behaviour. * Fixing lint issues * Fix issue by using dict attribute * Fix unit tests * fix lint test * Add unit tests * Fix unit tests * Adding changlog fragment * Update changelogs/fragments/602-show-all-slaves-status.yaml Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me> * Refactoring change by moving common logic to the module_utils * Fix sanity checks * Fix sanity checks * Adding lines to fix sanity checks * Fixing sanity checks * Update changelogs/fragments/602-show-all-slaves-status.yaml Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Removing is_mariadb and is_mysql functions --------- Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
051aa48d8d
commit
852c19a78a
5 changed files with 47 additions and 11 deletions
|
@ -1,9 +1,10 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.mysql.plugins.module_utils.mysql import get_server_version
|
||||
from ansible_collections.community.mysql.plugins.module_utils.mysql import get_server_version, get_server_implementation
|
||||
from ..utils import dummy_cursor_class
|
||||
|
||||
|
||||
|
@ -22,3 +23,21 @@ def test_get_server_version(cursor_return_version, cursor_return_type):
|
|||
"""
|
||||
cursor = dummy_cursor_class(cursor_return_version, cursor_return_type)
|
||||
assert get_server_version(cursor) == cursor_return_version
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'cursor_return_version,cursor_return_type,server_implementation',
|
||||
[
|
||||
('5.7.0-mysql', 'dict', 'mysql'),
|
||||
('8.0.0-mysql', 'list', 'mysql'),
|
||||
('10.5.0-mariadb', 'dict', 'mariadb'),
|
||||
('10.5.1-mariadb', 'list', 'mariadb'),
|
||||
]
|
||||
)
|
||||
def test_get_server_implamentation(cursor_return_version, cursor_return_type, server_implementation):
|
||||
"""
|
||||
Test that server implementation are handled properly by get_server_implementation() whether the server version returned as a list or dict.
|
||||
"""
|
||||
cursor = dummy_cursor_class(cursor_return_version, cursor_return_type)
|
||||
|
||||
assert get_server_implementation(cursor) == server_implementation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue