]> git.proxmox.com Git - mirror_frr.git/commitdiff
topotests: skip tests when any assert fails
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 1 Oct 2019 00:15:15 +0000 (21:15 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 1 Oct 2019 00:15:15 +0000 (21:15 -0300)
When an `assert` fails we should skip all other tests on the file. Once
a failure is detected we can't rely on the setup anymore, since most of
the tests assume the previous worked.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
tests/topotests/conftest.py

index 49e48ba927c20027a631861781b3f926dbe9e051..76b0ab017ecfbba6ece2b2fd49c2adf63e8c879d 100755 (executable)
@@ -74,3 +74,9 @@ def pytest_runtest_makereport(item, call):
     parent._previousfailed = item
     logger.error('assert failed at "{}/{}": {}'.format(
         modname, item.name, call.excinfo.value))
+
+    # (topogen) Set topology error to avoid advancing in the test.
+    tgen = get_topogen()
+    if tgen is not None:
+        # This will cause topogen to report error on `routers_have_failure`.
+        tgen.set_error('{}/{}'.format(modname, item.name))