Skip to content

Commit cce9f54

Browse files
committed
Fix tests caugh by real testing on Fedora Host and C9S host
Lets' connect to proper DB including --disable certificates Let's check if Slave is really runnning before SQL command is called. Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent ec3c92e commit cce9f54

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

test/test_container_replication.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,33 @@ def test_replication(self):
5454
assert slave_cip
5555
slave_cid = self.replication_db.get_cid(cid_file_name=slave_cid_name)
5656
assert slave_cid
57-
print(f"Replica IP: {slave_cid}")
57+
print(f"Slave IP: {slave_cip}")
5858
# Now wait till the SOURCE will see the REPLICA
5959
result = self.replication_db.test_db_connection(
6060
container_ip=master_cip,
6161
username="root",
6262
password="root",
6363
)
6464
result = PodmanCLIWrapper.call_podman_command(
65-
cmd=f"exec {master_cid} mysql -uroot -e 'SHOW SLAVE HOSTS;' db",
65+
cmd=f"exec {master_cid} mysql -uroot -e 'SHOW SLAVE HOSTS;' {VARS.DB_NAME}",
6666
ignore_error=True,
6767
)
6868
print(f"Showing replicas: {result}")
6969
assert slave_cip in result, (
7070
f"Replica {slave_cip} not found in MASTER {master_cip}"
7171
)
72-
mysql_cmd = "mysql -uroot <<< 'show slave status\\G;'"
73-
slave_status = PodmanCLIWrapper.podman_exec_shell_command(
74-
cid_file_name=slave_cid,
75-
cmd=mysql_cmd,
72+
result = self.replication_db.test_db_connection(
73+
container_ip=slave_cip,
74+
username="root",
75+
password="root",
76+
)
77+
sql_cmd = "show slave status\\G;"
78+
mysql_cmd = f'mysql -uroot <<< "{sql_cmd}"'
79+
print(f"MySQL command: {mysql_cmd}")
80+
slave_status = PodmanCLIWrapper.call_podman_command(
81+
cmd=f"exec {slave_cid} bash -c '{mysql_cmd}'",
7682
)
7783
print(f"Slave status: {slave_status}")
78-
assert slave_status
7984
assert re.search(r"Slave_IO_Running:\s*Yes", slave_status), (
8085
f"Slave {slave_cid} is not running"
8186
)

test/test_container_ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_ssl(self):
7575

7676
mysql_cmd = (
7777
f"mysql --host {cip} -u{username} -p{password} --ssl-ca={ca_cert_path}"
78-
+ " -e 'show status like \"Ssl_cipher\" \\G' db"
78+
+ f" -e 'show status like \"Ssl_cipher\" \\G' {VARS.DB_NAME}"
7979
)
8080
ssl_output = PodmanCLIWrapper.podman_run_command(
8181
cmd=f"--rm -v {ssl_dir}:/opt/app-root/src/:z {VARS.IMAGE_NAME} {mysql_cmd}",

0 commit comments

Comments
 (0)