From 7cb9d2b46e88b8ddd3582ea229bd929c31be3832 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 16 Mar 2015 12:04:27 -0400 Subject: [PATCH] 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 --- shade/tests/functional/test_compute.py | 4 ++-- tox.ini | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/shade/tests/functional/test_compute.py b/shade/tests/functional/test_compute.py index 6e456b1a8..44f6e4725 100644 --- a/shade/tests/functional/test_compute.py +++ b/shade/tests/functional/test_compute.py @@ -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) diff --git a/tox.ini b/tox.ini index 71cbd48c8..52264275c 100644 --- a/tox.ini +++ b/tox.ini @@ -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