Clean up race condition in functional tests

This could all be made much fancier - but in general, for now, kill
concurrency until we can get much richer isolation put in - and make
sure that we're only cleaning up servers that we created in the test.

Change-Id: Iea341076f55f41573ee2bb0f378c8602d21b39a2
This commit is contained in:
Monty Taylor 2015-03-16 12:04:27 -04:00
parent 3caca5554b
commit 7cb9d2b46e
2 changed files with 3 additions and 2 deletions

View File

@ -37,14 +37,14 @@ class TestCompute(base.TestCase):
self.image = pick_image(self.nova.images.list())
if self.image is None:
self.addDetail('pick_image', 'no sensible image available')
self.addCleanup(self._cleanup_servers)
def _cleanup_servers(self):
for i in self.nova.servers.list():
if i.name.startswith('test'):
if i.name.startswith('test_create'):
self.nova.servers.delete(i)
def test_create_server(self):
self.addCleanup(self._cleanup_servers)
server = self.cloud.create_server(name='test_create_server',
image=self.image, flavor=self.flavor)
self.assertIsInstance(server, Server)

View File

@ -18,6 +18,7 @@ commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:functional]
setenv =
OS_TEST_PATH = ./shade/tests/functional
commands = python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}'
[testenv:pep8]
commands = flake8