From d80734f7cd884ef1261ace989549cad28de010f2 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 26 Nov 2018 22:05:48 +0900 Subject: [PATCH] test-network: add one more test for netdev dropin .conf files For netdev, config files are loaded twice, and the first time, only Match and NetDev setions are read. So, the test given by the previous commit covers only the second loading. This adds another test that also covers the first loading. --- test/test-network/conf/10-dropin-test.netdev | 4 ++++ .../conf/10-dropin-test.netdev.d/mac.conf | 2 ++ .../conf/10-dropin-test.netdev.d/name.conf | 2 ++ test/test-network/systemd-networkd-tests.py | 15 +++++++++++++-- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 test/test-network/conf/10-dropin-test.netdev create mode 100644 test/test-network/conf/10-dropin-test.netdev.d/mac.conf create mode 100644 test/test-network/conf/10-dropin-test.netdev.d/name.conf diff --git a/test/test-network/conf/10-dropin-test.netdev b/test/test-network/conf/10-dropin-test.netdev new file mode 100644 index 00000000000..d85ea5bb72d --- /dev/null +++ b/test/test-network/conf/10-dropin-test.netdev @@ -0,0 +1,4 @@ +[NetDev] +Name=hoge +Kind=dummy +MACAddress=00:50:56:c0:00:18 diff --git a/test/test-network/conf/10-dropin-test.netdev.d/mac.conf b/test/test-network/conf/10-dropin-test.netdev.d/mac.conf new file mode 100644 index 00000000000..0b3f7659321 --- /dev/null +++ b/test/test-network/conf/10-dropin-test.netdev.d/mac.conf @@ -0,0 +1,2 @@ +[NetDev] +MACAddress=00:50:56:c0:00:28 diff --git a/test/test-network/conf/10-dropin-test.netdev.d/name.conf b/test/test-network/conf/10-dropin-test.netdev.d/name.conf new file mode 100644 index 00000000000..99059320a23 --- /dev/null +++ b/test/test-network/conf/10-dropin-test.netdev.d/name.conf @@ -0,0 +1,2 @@ +[NetDev] +Name=dropin-test diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 11b4aa12734..2525a35f761 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -153,7 +153,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): links =['bridge99', 'bond99', 'bond99', 'vlan99', 'test1', 'macvtap99', 'macvlan99', 'ipvlan99', 'vxlan99', 'veth99', 'vrf99', 'tun99', 'tap99', 'vcan99', 'geneve99', 'dummy98', 'ipiptun99', 'sittun99', '6rdtun99', - 'gretap99', 'vtitun99', 'vti6tun99','ip6tnl99', 'gretun99', 'ip6gretap99', 'wg99'] + 'gretap99', 'vtitun99', 'vti6tun99','ip6tnl99', 'gretun99', 'ip6gretap99', 'wg99', 'dropin-test'] units = ['25-bridge.netdev', '25-bond.netdev', '21-vlan.netdev', '11-dummy.netdev', '21-vlan.network', '21-macvtap.netdev', 'macvtap.network', '21-macvlan.netdev', 'macvlan.network', 'vxlan.network', @@ -163,7 +163,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): '25-gre-tunnel.netdev', '25-gretap-tunnel.netdev', '25-vti-tunnel.netdev', '25-vti6-tunnel.netdev', '12-dummy.netdev', 'gre.network', 'ipip.network', 'ip6gretap.network', 'gretun.network', 'ip6tnl.network', '25-tap.netdev', 'vti6.network', 'vti.network', 'gretap.network', 'sit.network', - '25-ipip-tunnel-independent.netdev', '25-wireguard.netdev', '6rd.network'] + '25-ipip-tunnel-independent.netdev', '25-wireguard.netdev', '6rd.network', '10-dropin-test.netdev'] def setUp(self): self.link_remove(self.links) @@ -172,6 +172,17 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): self.link_remove(self.links) self.remove_unit_from_networkd_path(self.units) + def test_dropin(self): + self.copy_unit_to_networkd_unit_path('10-dropin-test.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('dropin-test')) + + output = subprocess.check_output(['ip', 'link', 'show', 'dropin-test']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '00:50:56:c0:00:28') + def test_bridge(self): self.copy_unit_to_networkd_unit_path('25-bridge.netdev') self.start_networkd() -- 2.47.3