test(functional): Don't use a dead test server
It appears that when running in the gate, the wsgiref server sometimes goes away. This adds a check to only reuse a server instance if it is still alive. Change-Id: I87716f9feb80da63a6b8c1f629178b396dbeb4c6
This commit is contained in:
parent
7384b1e8b1
commit
7a9c45a5b2
@ -52,10 +52,10 @@ class FunctionalTestBase(testing.TestBase):
|
|||||||
self.mconf = self.load_conf(self.cfg.marconi.config)
|
self.mconf = self.load_conf(self.cfg.marconi.config)
|
||||||
|
|
||||||
# NOTE(flaper87): Use running instances.
|
# NOTE(flaper87): Use running instances.
|
||||||
if (self.cfg.marconi.run_server and not
|
if self.cfg.marconi.run_server:
|
||||||
self.server):
|
if not (self.server and self.server.is_alive()):
|
||||||
self.server = self.server_class()
|
self.server = self.server_class()
|
||||||
self.server.start(self.mconf)
|
self.server.start(self.mconf)
|
||||||
|
|
||||||
validator = validation.Validator(self.mconf)
|
validator = validation.Validator(self.mconf)
|
||||||
self.limits = validator._limits_conf
|
self.limits = validator._limits_conf
|
||||||
@ -179,7 +179,6 @@ class Server(object):
|
|||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
__metaclass__ = abc.ABCMeta
|
||||||
|
|
||||||
servers = {}
|
|
||||||
name = "marconi-functional-test-server"
|
name = "marconi-functional-test-server"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -198,6 +197,14 @@ class Server(object):
|
|||||||
:returns: A callable object
|
:returns: A callable object
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def is_alive(self):
|
||||||
|
"""Returns True IFF the server is running."""
|
||||||
|
|
||||||
|
if self.process is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return self.process.is_alive()
|
||||||
|
|
||||||
def start(self, conf):
|
def start(self, conf):
|
||||||
"""Starts the server process.
|
"""Starts the server process.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user