From: Yu Watanabe Date: Fri, 24 May 2019 04:39:50 +0000 (+0900) Subject: test-network: remove fou ports on failure X-Git-Tag: v243-rc1~356^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=def9fc0d657ec22549f10da567aa62f44f97b7de;p=thirdparty%2Fsystemd.git test-network: remove fou ports on failure --- diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index d809e72abc3..32efc229297 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -112,6 +112,10 @@ class Utilities(): subprocess.call(['ip', 'link', 'del', 'dev', link]) time.sleep(1) + def remove_fou_ports(self, ports): + for port in ports: + subprocess.call(['ip', 'fou', 'del', 'port', port]) + def l2tp_tunnel_remove(self, tunnel_ids): output = subprocess.check_output(['ip', 'l2tp', 'show', 'tunnel'], universal_newlines=True).rstrip() for tid in tunnel_ids: @@ -371,10 +375,16 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): 'vxlan-test1.network', 'vxlan.network'] + fou_ports = [ + '55555', + '55556'] + def setUp(self): + self.remove_fou_ports(self.fou_ports) self.link_remove(self.links) def tearDown(self): + self.remove_fou_ports(self.fou_ports) self.link_remove(self.links) self.remove_unit_from_networkd_path(self.units) @@ -924,9 +934,6 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55556') - subprocess.call(['ip', 'fou', 'del', 'port', '55555']) - subprocess.call(['ip', 'fou', 'del', 'port', '55556']) - def test_vxlan(self): self.copy_unit_to_networkd_unit_path('25-vxlan.netdev', 'vxlan.network', '11-dummy.netdev', 'vxlan-test1.network')