summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/topogen.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/lib/topogen.py')
-rw-r--r--tests/topotests/lib/topogen.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py
index 20f0eda39e..758ebcf2bf 100644
--- a/tests/topotests/lib/topogen.py
+++ b/tests/topotests/lib/topogen.py
@@ -322,6 +322,10 @@ class Topogen(object):
def is_memleak_enabled(self):
"Returns `True` if memory leak report is enable, otherwise `False`."
+ # On router failure we can't run the memory leak test
+ if self.routers_have_failure():
+ return False
+
memleak_file = (os.environ.get('TOPOTESTS_CHECK_MEMLEAK') or
self.config.get(self.CONFIG_SECTION, 'memleak_path'))
if memleak_file is None:
@@ -355,6 +359,24 @@ class Topogen(object):
"Returns whether errors exist or not."
return len(self.errors) > 0
+ def routers_have_failure(self):
+ "Runs an assertion to make sure that all routers are running."
+ if self.has_errors():
+ return True
+
+ errors = ''
+ router_list = self.routers().values()
+ for router in router_list:
+ result = router.check_router_running()
+ if result != '':
+ errors += result + '\n'
+
+ if errors != '':
+ self.set_error(errors, 'router_error')
+ assert errors != '', errors
+ return True
+ return False
+
#
# Topology gears (equipment)
#