Merge "slo: 500 if we can't load the manifest"

This commit is contained in:
Zuul 2023-09-06 01:11:01 +00:00 committed by Gerrit Code Review
commit 957743f25f
2 changed files with 9 additions and 5 deletions

View File

@ -942,7 +942,7 @@ class SloGetContext(WSGIContext):
try:
segments = json.loads(resp_body)
except ValueError:
segments = []
raise HTTPServerError('Unable to load SLO manifest')
return segments

View File

@ -3324,10 +3324,14 @@ class TestSloGetManifest(SloTestCase):
status, headers, body = self.call_slo(req)
headers = HeaderKeyDict(headers)
self.assertEqual(status, '200 OK')
self.assertEqual(headers['Content-Length'], '0')
self.assertEqual(headers['X-Object-Meta-Fish'], 'Bass')
self.assertEqual(body, b'')
# This often (usually?) happens because of an incomplete read -- the
# proxy app started getting a large manifest and sending it back to
# SLO, then there was a timeout or something, couldn't resume in time,
# and we've got just part of a JSON document. Having the client retry
# seems reasonable
self.assertEqual(status, '500 Internal Error')
self.assertEqual(body, b'Unable to load SLO manifest')
self.assertNotIn('X-Object-Meta-Fish', headers)
def _do_test_generator_closure(self, leaks):
# Test that the SLO WSGI iterable closes its internal .app_iter when