Skip to content

Commit bb107f0

Browse files
authored
Fixed bug in table count check, and added in encryption test check (#13)
1 parent 05a940f commit bb107f0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

suite/ssl/encryption_qa.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ def encryption_qa(self):
127127
print(data_load_query)
128128
result = os.system(data_load_query)
129129
utility_cmd.check_testcase(result, "Sample data load")
130+
131+
# Checksum for tables in test DB for 8.0.
132+
version = utility_cmd.version_check(BASEDIR)
133+
if int(version) >= int("080000"):
134+
result = utility_cmd.check_table_count(BASEDIR, 'test', WORKDIR + '/node1/mysql.sock',
135+
WORKDIR + '/node2/mysql.sock')
136+
utility_cmd.check_testcase(result, "Checksum run for DB: test")
137+
130138
utility_cmd.stop_pxc(WORKDIR, BASEDIR, NODE)
131139

132140

util/utility.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def check_table_count(self, basedir, db, socket1, socket2):
7070
query = basedir + '/bin/mysql -uroot ' + db + ' --socket=' + \
7171
socket1 + ' -Bse"show tables;"'
7272
tables = os.popen(query).read().rstrip()
73+
tables_names = tables.split('\n')
7374
# Compare the table checksum between node1 and node2
74-
for table in tables.split('\n'):
75+
for index, table in enumerate(tables_names):
7576
query = basedir + '/bin/mysql -uroot --socket=' + \
7677
socket1 + ' -Bse"checksum table ' + \
7778
db + '.' + table + ';"'
@@ -87,7 +88,12 @@ def check_table_count(self, basedir, db, socket1, socket2):
8788
print(query)
8889
print('Table count ' + table_count_node2)
8990
if table_count_node1 == table_count_node2:
90-
return 0
91+
# Using Mod, get index of element and check if we reached to the end
92+
# of list, if so return otherwise continue checking other tables.
93+
next_index = (index + 1) % len(tables_names)
94+
if next_index == 0:
95+
return 0
96+
else: continue
9197
else:
9298
print("\tTable(" + db + '.' + table + " ) checksum is different")
9399
return 1

0 commit comments

Comments
 (0)