Correctly stop functional servers
When running integration tests, the test suite starts real zaqar servers. The tearDown class was not stopping those servers correctly, which made the test suite re-use server instances when that was not necessary, causing other tests to fail. Change-Id: Ie701a8a609f8661c3607890c4b1b37ab110b155b Closes-bug: #1383604
This commit is contained in:
parent
4bf38b3706
commit
f0e4a810ff
@ -48,6 +48,7 @@ class FunctionalTestBase(testing.TestBase):
|
||||
|
||||
server = None
|
||||
server_class = None
|
||||
config_file = None
|
||||
|
||||
def setUp(self):
|
||||
super(FunctionalTestBase, self).setUp()
|
||||
@ -60,7 +61,8 @@ class FunctionalTestBase(testing.TestBase):
|
||||
if not self.cfg.run_tests:
|
||||
self.skipTest("Functional tests disabled")
|
||||
|
||||
self.mconf = self.load_conf(self.cfg.zaqar.config)
|
||||
self.mconf = self.load_conf(self.config_file or
|
||||
self.cfg.zaqar.config)
|
||||
|
||||
validator = validation.Validator(self.mconf)
|
||||
self.limits = validator._limits_conf
|
||||
@ -78,6 +80,7 @@ class FunctionalTestBase(testing.TestBase):
|
||||
if not (self.server and self.server.is_alive()):
|
||||
self.server = self.server_class()
|
||||
self.server.start(self.mconf)
|
||||
self.addCleanup(self.server.process.terminate)
|
||||
|
||||
self.client = http.Client()
|
||||
else:
|
||||
@ -99,11 +102,6 @@ class FunctionalTestBase(testing.TestBase):
|
||||
|
||||
self.client.set_headers(self.headers)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
if cls.server:
|
||||
cls.server.process.terminate()
|
||||
|
||||
def assertIsSubset(self, required_values, actual_values):
|
||||
"""Checks if a list is subset of another.
|
||||
|
||||
@ -281,7 +279,6 @@ class ZaqarAdminServer(Server):
|
||||
def get_target(self, conf):
|
||||
conf.admin_mode = True
|
||||
server = bootstrap.Bootstrap(conf)
|
||||
conf.admin_mode = False
|
||||
return server.run
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user