Fix test_replicator assertion

Because random.randint includeds both endpoints so that
random.randint(0, 9) which is assigned in replicatore
should be [0-9]. Hence, the assertion for replication_cycle should be
*less or equal to* 9. And the replication_cycle should be mod of 10.

Change-Id: I81da375a4864256e8f3b473d4399402f83fc6aeb
This commit is contained in:
Kota Tsuyuzaki 2017-02-06 04:08:40 -08:00
parent fc09dda92b
commit b1c36dc154

View File

@ -314,10 +314,10 @@ class TestObjectReplicator(unittest.TestCase):
(0, '', ['rsync', whole_path_from, rsync_mods]))
start = replicator.replication_cycle
self.assertGreaterEqual(start, 0)
self.assertLess(start, 9)
self.assertLessEqual(start, 9)
with _mock_process(process_arg_checker):
replicator.run_once()
self.assertEqual(start + 1, replicator.replication_cycle)
self.assertEqual((start + 1) % 10, replicator.replication_cycle)
self.assertFalse(process_errors)
self.assertFalse(self.logger.get_lines_for_level('error'))
object_replicator.http_connect = was_connector