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.
This commit is contained in:
Yu Watanabe 2018-11-26 22:05:48 +09:00
parent 013c8dc94d
commit d80734f7cd
4 changed files with 21 additions and 2 deletions

View file

@ -0,0 +1,4 @@
[NetDev]
Name=hoge
Kind=dummy
MACAddress=00:50:56:c0:00:18

View file

@ -0,0 +1,2 @@
[NetDev]
MACAddress=00:50:56:c0:00:28

View file

@ -0,0 +1,2 @@
[NetDev]
Name=dropin-test

View file

@ -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()