summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhufl <zhu.fanglei@zte.com.cn>2019-07-03 16:41:38 +0800
committerTim Burke <tim.burke@gmail.com>2019-10-18 13:46:16 -0700
commit60bcf8f548de308a27b57a3cc6619ef5f6af78ae (patch)
tree6fa9f53208df3768a8adf3da9d775b13c092d9a8
parent3d5f7aa41db7dd06e0965bd7494f2b23e7caf3f3 (diff)
downloadswift-60bcf8f548de308a27b57a3cc6619ef5f6af78ae.tar.gz
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 (cherry picked from commit 0fec28ab155276d099d1d4c9fd377f3da539077b)
-rw-r--r--test/unit/container/test_sync.py12
-rw-r--r--test/unit/obj/test_replicator.py2
2 files changed, 8 insertions, 6 deletions
diff --git a/test/unit/container/test_sync.py b/test/unit/container/test_sync.py
index d3c7e468d..833304bfa 100644
--- a/test/unit/container/test_sync.py
+++ b/test/unit/container/test_sync.py
@@ -793,11 +793,13 @@ class TestContainerSync(unittest.TestCase):
# Succeeds because no rows match
log_line = cs.logger.get_lines_for_level('info')[0]
lines = log_line.split(',')
- 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.assertEqual('total_rows: 1', lines.pop().strip())
+ self.assertEqual('sync_point2: None', lines.pop().strip())
+ self.assertEqual('sync_point1: 5', lines.pop().strip())
+ self.assertEqual('bytes: 0', 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):
self._test_container_sync_row_delete(None, None)
diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py
index 781a3de17..20dd320ec 100644
--- a/test/unit/obj/test_replicator.py
+++ b/test/unit/obj/test_replicator.py
@@ -469,7 +469,7 @@ class TestObjectReplicator(unittest.TestCase):
for job in jobs:
jobs_by_pol_part[str(int(job['policy'])) + job['partition']] = job
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(
[node['id'] for node in jobs_by_pol_part['00']['nodes']], [1, 2])
self.assertEqual(