From f3525b0b17f40157c7f723693454430210bf5b64 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Wed, 17 May 2023 07:10:13 -0400 Subject: [PATCH] tests: fix implicit config file and recently added logic error - Restore default of looking for a daemon config underneath the router directory if no config file was specified. - Recent change for adding unified config support had a logic bug, fix - Update the one test that conflicted with this default - comment out asyncio option causing warnings if asyncio wasn't installed. Signed-off-by: Christian Hopps --- tests/topotests/bgp_auth/test_bgp_auth1.py | 4 ++-- tests/topotests/bgp_auth/test_bgp_auth2.py | 4 ++-- tests/topotests/bgp_auth/test_bgp_auth3.py | 4 ++-- tests/topotests/bgp_auth/test_bgp_auth4.py | 4 ++-- tests/topotests/lib/topotest.py | 7 +++++-- tests/topotests/pytest.ini | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/topotests/bgp_auth/test_bgp_auth1.py b/tests/topotests/bgp_auth/test_bgp_auth1.py index 566d391f7a..9d47106c07 100644 --- a/tests/topotests/bgp_auth/test_bgp_auth1.py +++ b/tests/topotests/bgp_auth/test_bgp_auth1.py @@ -158,8 +158,8 @@ def setup_module(mod): # For all registered routers, load the zebra configuration file for rname, router in router_list.items(): router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf") - router.load_config(TopoRouter.RD_OSPF) - router.load_config(TopoRouter.RD_BGP) + router.load_config(TopoRouter.RD_OSPF, "") + router.load_config(TopoRouter.RD_BGP, "") # After copying the configurations, this function loads configured daemons. tgen.start_router() diff --git a/tests/topotests/bgp_auth/test_bgp_auth2.py b/tests/topotests/bgp_auth/test_bgp_auth2.py index 0e9942a227..6b92036727 100644 --- a/tests/topotests/bgp_auth/test_bgp_auth2.py +++ b/tests/topotests/bgp_auth/test_bgp_auth2.py @@ -158,8 +158,8 @@ def setup_module(mod): # For all registered routers, load the zebra configuration file for rname, router in router_list.items(): router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf") - router.load_config(TopoRouter.RD_OSPF) - router.load_config(TopoRouter.RD_BGP) + router.load_config(TopoRouter.RD_OSPF, "") + router.load_config(TopoRouter.RD_BGP, "") # After copying the configurations, this function loads configured daemons. tgen.start_router() diff --git a/tests/topotests/bgp_auth/test_bgp_auth3.py b/tests/topotests/bgp_auth/test_bgp_auth3.py index 99a8953b3f..2237c6b1b6 100644 --- a/tests/topotests/bgp_auth/test_bgp_auth3.py +++ b/tests/topotests/bgp_auth/test_bgp_auth3.py @@ -157,8 +157,8 @@ def setup_module(mod): # For all registered routers, load the zebra configuration file for rname, router in router_list.items(): router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf") - router.load_config(TopoRouter.RD_OSPF) - router.load_config(TopoRouter.RD_BGP) + router.load_config(TopoRouter.RD_OSPF, "") + router.load_config(TopoRouter.RD_BGP, "") # After copying the configurations, this function loads configured daemons. tgen.start_router() diff --git a/tests/topotests/bgp_auth/test_bgp_auth4.py b/tests/topotests/bgp_auth/test_bgp_auth4.py index dffef0eef7..d6fe42504b 100644 --- a/tests/topotests/bgp_auth/test_bgp_auth4.py +++ b/tests/topotests/bgp_auth/test_bgp_auth4.py @@ -157,8 +157,8 @@ def setup_module(mod): # For all registered routers, load the zebra configuration file for rname, router in router_list.items(): router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf") - router.load_config(TopoRouter.RD_OSPF) - router.load_config(TopoRouter.RD_BGP) + router.load_config(TopoRouter.RD_OSPF, "") + router.load_config(TopoRouter.RD_BGP, "") # After copying the configurations, this function loads configured daemons. tgen.start_router() diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 9c594d3c8e..aeb83d4290 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -1527,6 +1527,9 @@ class Router(Node): """ # Unfortunately this API allowsfor source to not exist for any and all routers. + if source is None: + source = f"{daemon}.conf" + if source: head, tail = os.path.split(source) if not head and not self.path_exists(tail): @@ -1558,7 +1561,7 @@ class Router(Node): self.cmd_raises("cp {} {}".format(source, conf_file_mgmt)) self.cmd_raises("cp {} {}".format(source, conf_file)) - if not self.unified_config or daemon == "frr": + if not (self.unified_config or daemon == "frr"): self.cmd_raises("chown {0}:{0} {1}".format(self.routertype, conf_file)) self.cmd_raises("chmod 664 {}".format(conf_file)) @@ -1952,7 +1955,7 @@ class Router(Node): tail_log_files.append("{}/{}/frr.log".format(self.logdir, self.name)) for tailf in tail_log_files: - self.run_in_window("tail -f " + tailf, title=tailf, background=True) + self.run_in_window("tail -n10000 -F " + tailf, title=tailf, background=True) return "" diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini index f779bf0a74..0062cf3de2 100644 --- a/tests/topotests/pytest.ini +++ b/tests/topotests/pytest.ini @@ -1,7 +1,7 @@ # Skip pytests example directory [pytest] -asyncio_mode = auto +# asyncio_mode = auto # We always turn this on inside conftest.py, default shown # addopts = --junitxml=/topotests.xml -- 2.39.5