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,8 +52,8 @@ class FunctionalTestBase(testing.TestBase):
|
||||
self.mconf = self.load_conf(self.cfg.marconi.config)
|
||||
|
||||
# NOTE(flaper87): Use running instances.
|
||||
if (self.cfg.marconi.run_server and not
|
||||
self.server):
|
||||
if self.cfg.marconi.run_server:
|
||||
if not (self.server and self.server.is_alive()):
|
||||
self.server = self.server_class()
|
||||
self.server.start(self.mconf)
|
||||
|
||||
@ -179,7 +179,6 @@ class Server(object):
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
servers = {}
|
||||
name = "marconi-functional-test-server"
|
||||
|
||||
def __init__(self):
|
||||
@ -198,6 +197,14 @@ class Server(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):
|
||||
"""Starts the server process.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user