mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 07:15:19 +00:00
tests: fix router stop logic
Change the public router stop method to always do a two-phase shutdown - once without waiting and a second time with a wait. Ordinary callers need to use this approach when stopping routers. Move the detailed internal details to a private method that tests should not call directly. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
a85a3d1ef9
commit
942a224eae
@ -335,9 +335,7 @@ class Topogen(object):
|
|||||||
logger.info("stopping topology: {}".format(self.modname))
|
logger.info("stopping topology: {}".format(self.modname))
|
||||||
errors = ""
|
errors = ""
|
||||||
for gear in self.gears.values():
|
for gear in self.gears.values():
|
||||||
gear.stop(False, False)
|
errors += gear.stop()
|
||||||
for gear in self.gears.values():
|
|
||||||
errors += gear.stop(True, False)
|
|
||||||
if len(errors) > 0:
|
if len(errors) > 0:
|
||||||
assert "Errors found post shutdown - details follow:" == 0, errors
|
assert "Errors found post shutdown - details follow:" == 0, errors
|
||||||
|
|
||||||
@ -703,14 +701,26 @@ class TopoRouter(TopoGear):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def stop(self, wait=True, assertOnError=True):
|
def __stop_internal(self, wait=True, assertOnError=True):
|
||||||
"""
|
"""
|
||||||
Stop router:
|
Stop router, private internal version
|
||||||
* Kill daemons
|
* Kill daemons
|
||||||
"""
|
"""
|
||||||
self.logger.debug("stopping")
|
self.logger.debug("stopping: wait {}, assert {}".format(
|
||||||
|
wait, assertOnError))
|
||||||
return self.tgen.net[self.name].stopRouter(wait, assertOnError)
|
return self.tgen.net[self.name].stopRouter(wait, assertOnError)
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
"""
|
||||||
|
Stop router cleanly:
|
||||||
|
* Signal daemons twice, once without waiting, and then a second time
|
||||||
|
with a wait to ensure the daemons exit cleanly
|
||||||
|
"""
|
||||||
|
self.logger.debug("stopping")
|
||||||
|
self.__stop_internal(False, False)
|
||||||
|
return self.__stop_internal()
|
||||||
|
|
||||||
def startDaemons(self, daemons):
|
def startDaemons(self, daemons):
|
||||||
"""
|
"""
|
||||||
Start Daemons: to start specific daemon(user defined daemon only)
|
Start Daemons: to start specific daemon(user defined daemon only)
|
||||||
@ -819,8 +829,7 @@ class TopoRouter(TopoGear):
|
|||||||
if memleak_file is None:
|
if memleak_file is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.stop(False, False)
|
self.stop()
|
||||||
self.stop(wait=True)
|
|
||||||
|
|
||||||
self.logger.info("running memory leak report")
|
self.logger.info("running memory leak report")
|
||||||
self.tgen.net[self.name].report_memory_leaks(memleak_file, testname)
|
self.tgen.net[self.name].report_memory_leaks(memleak_file, testname)
|
||||||
|
Loading…
Reference in New Issue
Block a user