Fix StopIteration noise in obj/test_replicator.py
Insufficient arguments are passed to create MockProcess instances resulting in StopIteration errors being raised during the repeated replicator run_once cycles added in [1]. The test passes because the replicator just logs these exceptions, but the logger noise is distracting when running the test [2]. [1] Related-Change: Ib5c9dd17e40150450ec57a728ae8652fbc730af6 [2] nosetests ./test/unit/obj/test_replicator.py:\ TestObjectReplicator.test_run_once -s Change-Id: I36208e93c81744068a3454577a30d0c5a8d9cb9b
This commit is contained in:
parent
3820e67448
commit
74700eb890
@ -328,10 +328,9 @@ class TestObjectReplicator(unittest.TestCase):
|
|||||||
while True:
|
while True:
|
||||||
yield 60
|
yield 60
|
||||||
|
|
||||||
with _mock_process(process_arg_checker):
|
for cycle in range(1, 10):
|
||||||
with mock.patch('time.time') as time_mock:
|
with _mock_process(process_arg_checker):
|
||||||
for cycle in range(1, 10):
|
with mock.patch('time.time', side_effect=_infinite_gen()):
|
||||||
time_mock.side_effect = _infinite_gen()
|
|
||||||
replicator.run_once()
|
replicator.run_once()
|
||||||
self.assertEqual((start + 1 + cycle) % 10,
|
self.assertEqual((start + 1 + cycle) % 10,
|
||||||
replicator.replication_cycle)
|
replicator.replication_cycle)
|
||||||
@ -345,6 +344,7 @@ class TestObjectReplicator(unittest.TestCase):
|
|||||||
self.assertIn('replication_last', recon)
|
self.assertIn('replication_last', recon)
|
||||||
expected = 'Object replication complete (once). (1.00 minutes)'
|
expected = 'Object replication complete (once). (1.00 minutes)'
|
||||||
self.assertIn(expected, self.logger.get_lines_for_level('info'))
|
self.assertIn(expected, self.logger.get_lines_for_level('info'))
|
||||||
|
self.assertFalse(self.logger.get_lines_for_level('error'))
|
||||||
object_replicator.http_connect = was_connector
|
object_replicator.http_connect = was_connector
|
||||||
|
|
||||||
# policy 1
|
# policy 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user