Always call stop_servers() after having started them in tests

Several functional tests were not stopping the servers.

Fix bug 1043416.

Change-Id: I362e116089e6baa3e8f9ab16be1d6c54dbf957da
This commit is contained in:
Vincent Untz 2012-09-03 08:45:57 +02:00
parent 3be563029a
commit a95ec3d893
3 changed files with 22 additions and 0 deletions

View File

@ -65,6 +65,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertNotEqual(0, exitcode)
self._assertNotIn('SSL23_GET_SERVER_HELLO', out)
self.stop_servers()
def test_add_with_location_and_id(self):
self.cleanup()
self.start_servers(**self.__dict__.copy())
@ -121,6 +123,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
"but got %s. " % size)
self.stop_servers()
def test_add_with_location(self):
self.cleanup()
self.start_servers(**self.__dict__.copy())
@ -163,6 +167,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
"but got %s. " % size)
self.stop_servers()
def test_add_no_name(self):
self.cleanup()
self.start_servers(**self.__dict__.copy())
@ -204,6 +210,8 @@ class TestBinGlance(functional.FunctionalTest):
[c.strip() for c in line.split()]
self.assertEqual('None', name)
self.stop_servers()
@requires(teardown=teardown_http)
def test_add_copying_from(self):
self.cleanup()
@ -248,6 +256,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual('5120', size, "Expected image to be 5120 bytes "
" in size, but got %s. " % size)
self.stop_servers()
def _do_test_update_external_source(self, source):
self.cleanup()
self.start_servers(**self.__dict__.copy())
@ -300,6 +310,8 @@ class TestBinGlance(functional.FunctionalTest):
lines = out.split("\n")
self.assertTrue(set(lines) >= set(expected_lines))
self.stop_servers()
@requires(teardown=teardown_http)
def test_update_copying_from(self):
"""
@ -363,6 +375,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
"but got %s. " % size)
self.stop_servers()
def test_add_list_delete_list(self):
"""
We test the following:
@ -1054,6 +1068,8 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual(0, exitcode)
self.assertEqual('Deleted image %s' % image_id, out.strip())
self.stop_servers()
def test_protected_image(self):
"""
We test the following:
@ -1252,3 +1268,5 @@ class TestBinGlance(functional.FunctionalTest):
self.assertEqual(0, exitcode)
self.assertEqual('', out.strip())
self.stop_servers()

View File

@ -334,6 +334,8 @@ class BaseCacheManageMiddlewareTest(object):
response, content = http.request(path, 'PUT')
self.assertEqual(response.status, 403)
self.stop_servers()
@skip_if_disabled
def test_cache_manage_get_cached_images(self):
"""

View File

@ -64,3 +64,5 @@ class TestSchemas(functional.FunctionalTest):
images_schema = json.loads(response.text)
item_schema = images_schema['properties']['images']['items']
self.assertEqual(item_schema, image_schema)
self.stop_servers()