test-network: add a test for renaming device to current altname

This commit is contained in:
Nick Rosbrook 2022-12-07 12:28:28 -05:00
parent b338a8bb40
commit f68f644a16
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
OriginalName=dummy98
[Link]
Name=dummyalt
AlternativeName=dummyalt hogehogehogehogehogehoge

View file

@ -933,6 +933,17 @@ class NetworkctlTests(unittest.TestCase, Utilities):
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
self.assertRegex(output, 'hogehogehogehogehogehoge')
@expectedFailureIfAlternativeNameIsNotAvailable()
def test_rename_to_altname(self):
copy_network_unit('26-netdev-link-local-addressing-yes.network',
'12-dummy.netdev', '12-dummy-rename-to-altname.link')
start_networkd()
self.wait_online(['dummyalt:degraded'])
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummyalt', env=env)
self.assertIn('hogehogehogehogehogehoge', output)
self.assertNotIn('dummy98', output)
def test_reconfigure(self):
copy_network_unit('25-address-static.network', '12-dummy.netdev')
start_networkd()