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:
Alistair Coles 2017-07-11 10:41:35 +01:00
parent 3820e67448
commit 74700eb890

View File

@ -328,10 +328,9 @@ class TestObjectReplicator(unittest.TestCase):
while True:
yield 60
with _mock_process(process_arg_checker):
with mock.patch('time.time') as time_mock:
for cycle in range(1, 10):
time_mock.side_effect = _infinite_gen()
for cycle in range(1, 10):
with _mock_process(process_arg_checker):
with mock.patch('time.time', side_effect=_infinite_gen()):
replicator.run_once()
self.assertEqual((start + 1 + cycle) % 10,
replicator.replication_cycle)
@ -345,6 +344,7 @@ class TestObjectReplicator(unittest.TestCase):
self.assertIn('replication_last', recon)
expected = 'Object replication complete (once). (1.00 minutes)'
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
# policy 1