Skip to content

Commit 8347a4a

Browse files
committed
fix more tests
1 parent 79b1f7d commit 8347a4a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tests/unit/plugins/module_utils/test_mariadb_replication.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def __init__(self, status="ONLINE"):
1616
self.executed_queries = []
1717

1818
def execute(self, query):
19+
if self.status == "ERROR":
20+
raise Exception("Mocked execution error")
1921
self.executed_queries.append(query)
2022

2123
def fetchone(self):
@@ -44,7 +46,7 @@ def test_uses_replica_terminology(f_output, c_output, c_ret_type):
4446
(None, None, "START GROUP_REPLICATION "),
4547
("repl_user", None, "START GROUP_REPLICATION USER='repl_user'"),
4648
(None, "repl_pass", "START GROUP_REPLICATION PASSWORD='repl_pass'"),
47-
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user', PASSWORD='repl_pass'"),
49+
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user',PASSWORD='repl_pass'"),
4850
]
4951
)
5052
def test_start_group_replication(user, password, expected_query):
@@ -58,9 +60,9 @@ def test_start_group_replication(user, password, expected_query):
5860

5961
chm = []
6062
if user:
61-
chm.append(" USER='%s'" % user)
63+
chm.append("USER='%s'" % user)
6264
if password:
63-
chm.append(" PASSWORD='%s'" % password)
65+
chm.append("PASSWORD='%s'" % password)
6466

6567
result = startgroupreplication(module, cursor, chm, False)
6668

tests/unit/plugins/module_utils/test_mysql_replication.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def __init__(self, status="ONLINE"):
1616
self.executed_queries = []
1717

1818
def execute(self, query):
19+
if self.status == "ERROR":
20+
raise Exception("Mocked execution error")
1921
self.executed_queries.append(query)
2022

2123
def fetchone(self):
@@ -48,7 +50,7 @@ def test_uses_replica_terminology(f_output, c_output, c_ret_type):
4850
(None, None, "START GROUP_REPLICATION "),
4951
("repl_user", None, "START GROUP_REPLICATION USER='repl_user'"),
5052
(None, "repl_pass", "START GROUP_REPLICATION PASSWORD='repl_pass'"),
51-
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user', PASSWORD='repl_pass'"),
53+
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user',PASSWORD='repl_pass'"),
5254
]
5355
)
5456
def test_start_group_replication(user, password, expected_query):

0 commit comments

Comments
 (0)