From d3946d97067c651c61bd84ed987912a69dfb92dc Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Fri, 1 Feb 2019 08:24:25 -0800 Subject: [PATCH] Fix flakey func test teardown Change-Id: I1cf9894af01f864fab5dc71c38f0fd7fe06faec2 --- test/functional/test_container.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/functional/test_container.py b/test/functional/test_container.py index c9b59db126..a85f53d42c 100644 --- a/test/functional/test_container.py +++ b/test/functional/test_container.py @@ -86,21 +86,23 @@ class TestContainer(unittest2.TestCase): for obj in objs: resp = retry(delete, container, obj) 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): conn.request('DELETE', parsed.path + '/' + container, '', {'X-Auth-Token': token}) return check_response(conn) - resp = retry(delete, self.name) - resp.read() - self.assertEqual(resp.status, 204) - - # container may have not been created - resp = retry(delete, self.container) - resp.read() - self.assertIn(resp.status, (204, 404)) + for container in (self.name, self.container): + resp = retry(delete, container) + resp.read() + # self.container may not have been created at all, but even if it + # has, for either container there may be a failure that trips the + # retry despite the request having been successfully processed. + self.assertIn(resp.status, (204, 404)) def test_multi_metadata(self): if tf.skip: