mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
test-network: add a test case for netdev altname
This commit is contained in:
parent
511070ee95
commit
6934ace05d
5
test/test-network/conf/12-dummy.link
Normal file
5
test/test-network/conf/12-dummy.link
Normal file
@ -0,0 +1,5 @@
|
||||
[Match]
|
||||
OriginalName=dummy98
|
||||
|
||||
[Link]
|
||||
AlternativeName=hogehogehogehogehogehoge
|
@ -14,6 +14,7 @@ Name=ifb99
|
||||
Name=ipiptun99
|
||||
Name=nlmon99
|
||||
Name=xfrm99
|
||||
Name=hogehogehogehogehogehoge
|
||||
|
||||
[Network]
|
||||
LinkLocalAddressing=yes
|
||||
|
@ -127,6 +127,17 @@ def expectedFailureIfNexthopIsNotAvailable():
|
||||
|
||||
return f
|
||||
|
||||
def expectedFailureIfAlternativeNameIsNotAvailable():
|
||||
def f(func):
|
||||
call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
|
||||
rc = call('ip link prop add dev dummy98 altname hogehogehogehogehoge', stderr=subprocess.DEVNULL)
|
||||
if rc == 0:
|
||||
return func
|
||||
else:
|
||||
return unittest.expectedFailure(func)
|
||||
|
||||
return f
|
||||
|
||||
def setUpModule():
|
||||
global running_units
|
||||
|
||||
@ -425,6 +436,7 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
'11-dummy-mtu.netdev',
|
||||
'11-dummy.network',
|
||||
'12-dummy.netdev',
|
||||
'12-dummy.link',
|
||||
'25-address-static.network',
|
||||
'25-veth.netdev',
|
||||
'netdev-link-local-addressing-yes.network',
|
||||
@ -439,6 +451,16 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
remove_unit_from_networkd_path(self.units)
|
||||
stop_networkd(show_logs=True)
|
||||
|
||||
@expectedFailureIfAlternativeNameIsNotAvailable()
|
||||
def test_altname(self):
|
||||
copy_unit_to_networkd_unit_path('netdev-link-local-addressing-yes.network', '12-dummy.netdev', '12-dummy.link')
|
||||
check_output('udevadm control --reload')
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'dummy98', env=env)
|
||||
self.assertRegex(output, 'hogehogehogehogehogehoge')
|
||||
|
||||
def test_reconfigure(self):
|
||||
copy_unit_to_networkd_unit_path('25-address-static.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
Loading…
Reference in New Issue
Block a user