Fix invalid assert states

This is to fix invalid assert states like:
    self.assertTrue('sync_point2: 5', lines.pop().strip())
    self.assertTrue('sync_point1: 5', lines.pop().strip())
    self.assertTrue('bytes: 1100', lines.pop().strip())
    self.assertTrue('deletes: 2', lines.pop().strip())
    self.assertTrue('puts: 3', lines.pop().strip())
    self.assertTrue('1', jobs_to_delete[0]['partition'])
in which assertEqual should be used.

Change-Id: Ide5af2ae68fae0e5d6eb5c233a24388bb9942144
This commit is contained in:
zhufl 2019-07-03 16:41:38 +08:00
parent bf3e2548b3
commit 0fec28ab15
2 changed files with 8 additions and 6 deletions

View File

@ -794,11 +794,13 @@ class TestContainerSync(unittest.TestCase):
# Succeeds because no rows match # Succeeds because no rows match
log_line = cs.logger.get_lines_for_level('info')[0] log_line = cs.logger.get_lines_for_level('info')[0]
lines = log_line.split(',') lines = log_line.split(',')
self.assertTrue('sync_point2: 5', lines.pop().strip()) self.assertEqual('total_rows: 1', lines.pop().strip())
self.assertTrue('sync_point1: 5', lines.pop().strip()) self.assertEqual('sync_point2: None', lines.pop().strip())
self.assertTrue('bytes: 1100', lines.pop().strip()) self.assertEqual('sync_point1: 5', lines.pop().strip())
self.assertTrue('deletes: 2', lines.pop().strip()) self.assertEqual('bytes: 0', lines.pop().strip())
self.assertTrue('puts: 3', lines.pop().strip()) self.assertEqual('deletes: 0', lines.pop().strip())
self.assertEqual('posts: 0', lines.pop().strip())
self.assertEqual('puts: 0', lines.pop().strip())
def test_container_sync_row_delete(self): def test_container_sync_row_delete(self):
self._test_container_sync_row_delete(None, None) self._test_container_sync_row_delete(None, None)

View File

@ -469,7 +469,7 @@ class TestObjectReplicator(unittest.TestCase):
for job in jobs: for job in jobs:
jobs_by_pol_part[str(int(job['policy'])) + job['partition']] = job jobs_by_pol_part[str(int(job['policy'])) + job['partition']] = job
self.assertEqual(len(jobs_to_delete), 2) self.assertEqual(len(jobs_to_delete), 2)
self.assertTrue('1', jobs_to_delete[0]['partition']) self.assertEqual('1', jobs_to_delete[0]['partition'])
self.assertEqual( self.assertEqual(
[node['id'] for node in jobs_by_pol_part['00']['nodes']], [1, 2]) [node['id'] for node in jobs_by_pol_part['00']['nodes']], [1, 2])
self.assertEqual( self.assertEqual(