diff options
| author | Rafael Zalamena <rzalamena@gmail.com> | 2017-07-12 11:38:31 -0300 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-11-27 20:22:11 -0500 |
| commit | 78ed61230c9d212f5a1c876c1942a3d15c4e1b7c (patch) | |
| tree | 88047d4a580d8e0cf5622c62e253f586b8906b45 /tests/topotests/lib/topogen.py | |
| parent | e84692970bbaffab808e4d4f21d19812dd566578 (diff) | |
topogen: implement router check method
Use a standard function to do 'router running checks' instead of having
to duplicate the code in every test.
Diffstat (limited to 'tests/topotests/lib/topogen.py')
| -rw-r--r-- | tests/topotests/lib/topogen.py | 22 |
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) # |
