Speed up functional testing

test/functional/tests.py:TestObjectVersioningUTF8 does not clean
up the versions files it creates because the class's multiple
inheritance is such that it does not call the tearDown method in
TestObjectVersioning.

As a result, any attempt to clean up account containers wastes
time retrying container delete requests. This occurs either in
the setUp for TestSloEnv, if the TestSlo class is included in a
test run, or in the tests.py package tearDown method.

On the author's dev machine this patch reduces the execution
time of functional tests in tests.py by approx 30% or 1 minute.

Change-Id: I8194672bf2ca82435df5868720b6a55a79b94413
This commit is contained in:
Alistair Coles 2016-02-08 15:31:42 +00:00
parent 76c38670c2
commit 87fc21c7cf

View File

@ -3359,16 +3359,19 @@ class TestObjectVersioning(Base):
"Expected versioning_enabled to be True/False, got %r" % "Expected versioning_enabled to be True/False, got %r" %
(self.env.versioning_enabled,)) (self.env.versioning_enabled,))
def tearDown(self): def _tear_down_files(self):
super(TestObjectVersioning, self).tearDown()
try: try:
# only delete files and not container # only delete files and not containers
# as they were configured in self.env # as they were configured in self.env
self.env.versions_container.delete_files() self.env.versions_container.delete_files()
self.env.container.delete_files() self.env.container.delete_files()
except ResponseError: except ResponseError:
pass pass
def tearDown(self):
super(TestObjectVersioning, self).tearDown()
self._tear_down_files()
def test_clear_version_option(self): def test_clear_version_option(self):
# sanity # sanity
self.assertEqual(self.env.container.info()['versions'], self.assertEqual(self.env.container.info()['versions'],
@ -3602,6 +3605,10 @@ class TestObjectVersioning(Base):
class TestObjectVersioningUTF8(Base2, TestObjectVersioning): class TestObjectVersioningUTF8(Base2, TestObjectVersioning):
set_up = False set_up = False
def tearDown(self):
self._tear_down_files()
super(TestObjectVersioningUTF8, self).tearDown()
class TestCrossPolicyObjectVersioning(TestObjectVersioning): class TestCrossPolicyObjectVersioning(TestObjectVersioning):
env = TestCrossPolicyObjectVersioningEnv env = TestCrossPolicyObjectVersioningEnv