Merge "Fix flakey func test teardown"

This commit is contained in:
Zuul 2019-02-07 17:38:29 +00:00 committed by Gerrit Code Review
commit 001bf535f0

View File

@ -86,21 +86,23 @@ class TestContainer(unittest2.TestCase):
for obj in objs: for obj in objs:
resp = retry(delete, container, obj) resp = retry(delete, container, obj)
resp.read() resp.read()
self.assertEqual(resp.status, 204) # Under load, container listing may not upate immediately,
# so we may attempt to delete the same object multiple
# times. Tolerate the object having already been deleted.
self.assertIn(resp.status, (204, 404))
def delete(url, token, parsed, conn, container): def delete(url, token, parsed, conn, container):
conn.request('DELETE', parsed.path + '/' + container, '', conn.request('DELETE', parsed.path + '/' + container, '',
{'X-Auth-Token': token}) {'X-Auth-Token': token})
return check_response(conn) return check_response(conn)
resp = retry(delete, self.name) for container in (self.name, self.container):
resp.read() resp = retry(delete, container)
self.assertEqual(resp.status, 204) resp.read()
# self.container may not have been created at all, but even if it
# container may have not been created # has, for either container there may be a failure that trips the
resp = retry(delete, self.container) # retry despite the request having been successfully processed.
resp.read() self.assertIn(resp.status, (204, 404))
self.assertIn(resp.status, (204, 404))
def test_multi_metadata(self): def test_multi_metadata(self):
if tf.skip: if tf.skip: