From d1fe6a1c2725c8611b52c651c25f98962d3192e0 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 19 Jan 2024 13:54:15 +0000 Subject: [PATCH] [FT] Add more information to ``IpRouteCommandTestCase`` if fails If a test case fails, now the routes present in the system are printed too. Related-Bug: #1988037 Change-Id: Ie8931068bc6d3cb401f3dc70654d9b3d6f0e5281 --- neutron/tests/functional/agent/linux/test_ip_lib.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index 4767af617bf..b96e517ed22 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -931,14 +931,15 @@ class IpRouteCommandTestCase(functional_base.BaseSudoTestCase): def _assert_route(self, ip_version, table=None, source_prefix=None, cidr=None, scope=None, via=None, metric=None, not_in=False): + routes = self.device.route.list_routes(ip_version, table=table) if not_in: - fn = lambda: cmp not in self.device.route.list_routes(ip_version, - table=table) - msg = 'Route found: %s' + fn = lambda: cmp not in routes + msg = 'Route found: %s\nRoutes present: {routes}'.format( + routes=routes) else: - fn = lambda: cmp in self.device.route.list_routes(ip_version, - table=table) - msg = 'Route not found: %s' + fn = lambda: cmp in routes + msg = 'Route not found: %s\nRoutes present: {routes}'.format( + routes=routes) if cidr: ip_version = utils.get_ip_version(cidr)