From cce1a98074d944dd5ac1788af943352d512e4479 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Fri, 25 Apr 2025 21:05:14 +0200 Subject: smoketest: T7400: fix unbound variable when checking VXLAN remote and group settings FAIL: test_vxlan_group_remote_error (__main__.VXLANInterfaceTest.test_vxlan_group_remote_error) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/libexec/vyos/tests/smoke/cli/test_interfaces_vxlan.py", line 139, in test_vxlan_group_remote_error self.assertIn('Both group and remote cannot be specified', str(exception)) AssertionError: 'Both group and remote cannot be specified' not found in '[[interfaces vxlan vxlan60]] failed\nCommit failed\n' This happens because cm variable is accessed when no longer valid. Change behavior to match common smoketest style, check ConfigError exception - but do not check exception message. Fix the error and commit again. --- smoketest/scripts/cli/test_interfaces_vxlan.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_interfaces_vxlan.py b/smoketest/scripts/cli/test_interfaces_vxlan.py index 694c24e4d..132496124 100755 --- a/smoketest/scripts/cli/test_interfaces_vxlan.py +++ b/smoketest/scripts/cli/test_interfaces_vxlan.py @@ -125,19 +125,17 @@ class VXLANInterfaceTest(BasicInterfaceTest.TestCase): 'source-interface eth0', 'vni 60' ] - params = [] for option in options: opts = option.split() - params.append(opts[0]) - self.cli_set(self._base_path + [ intf ] + opts) + self.cli_set(self._base_path + [intf] + opts) - with self.assertRaises(ConfigSessionError) as cm: + # verify() - Both group and remote cannot be specified + with self.assertRaises(ConfigSessionError): self.cli_commit() - exception = cm.exception - self.assertIn('Both group and remote cannot be specified', str(exception)) - for param in params: - self.cli_delete(self._base_path + [intf, param]) + # Remove blocking CLI option + self.cli_delete(self._base_path + [intf, 'group']) + self.cli_commit() def test_vxlan_external(self): -- cgit v1.2.3