Merge "Add assertions to test_reconstructor test_get_response"
This commit is contained in:
commit
5c0814daa6
@ -680,19 +680,21 @@ class TestGlobalSetupObjectReconstructor(unittest.TestCase):
|
|||||||
self.assertIn('Trying to GET', line)
|
self.assertIn('Trying to GET', line)
|
||||||
# sanity Timeout has extra message in the error log
|
# sanity Timeout has extra message in the error log
|
||||||
self.assertIn('Timeout', line)
|
self.assertIn('Timeout', line)
|
||||||
|
self.logger.clear()
|
||||||
|
|
||||||
def test_reconstructor_does_not_log_on_404(self):
|
# we should get a warning on 503 (sanity)
|
||||||
part = self.part_nums[0]
|
resp = do_test(503)
|
||||||
node = POLICIES[1].object_ring.get_part_nodes(int(part))[0]
|
self.assertIsNone(resp)
|
||||||
with mocked_http_conn(404):
|
warnings = self.logger.get_lines_for_level('warning')
|
||||||
self.reconstructor._get_response(node, part,
|
self.assertEqual(1, len(warnings))
|
||||||
path='some_path',
|
self.assertIn('Invalid response 503', warnings[0])
|
||||||
headers={},
|
self.logger.clear()
|
||||||
policy=POLICIES[1])
|
|
||||||
|
|
||||||
# Make sure that no warnings are emitted for a 404
|
# ... but no messages should be emitted for 404
|
||||||
len_warning_lines = len(self.logger.get_lines_for_level('warning'))
|
resp = do_test(404)
|
||||||
self.assertEqual(len_warning_lines, 0)
|
self.assertIsNone(resp)
|
||||||
|
for level, msgs in self.logger.lines_dict.items():
|
||||||
|
self.assertFalse(msgs)
|
||||||
|
|
||||||
def test_reconstructor_skips_bogus_partition_dirs(self):
|
def test_reconstructor_skips_bogus_partition_dirs(self):
|
||||||
# A directory in the wrong place shouldn't crash the reconstructor
|
# A directory in the wrong place shouldn't crash the reconstructor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user