systemd/SOURCES/0388-test-network-add-a-test-for-renaming-device-to-curre.patch

51 lines
2.1 KiB
Diff
Raw Normal View History

2024-04-30 11:42:21 +00:00
From 6e095bdbd88ddbe289210720e7a55b62fa593ab8 Mon Sep 17 00:00:00 2001
From: Nick Rosbrook <nick.rosbrook@canonical.com>
Date: Wed, 7 Dec 2022 12:28:28 -0500
Subject: [PATCH] test-network: add a test for renaming device to current
altname
(cherry picked from commit f68f644a167af3452be853b631fa9144c6716c28)
Related: RHEL-5988
---
.../test-network/conf/12-dummy-rename-to-altname.link | 7 +++++++
test/test-network/systemd-networkd-tests.py | 11 +++++++++++
2 files changed, 18 insertions(+)
create mode 100644 test/test-network/conf/12-dummy-rename-to-altname.link
diff --git a/test/test-network/conf/12-dummy-rename-to-altname.link b/test/test-network/conf/12-dummy-rename-to-altname.link
new file mode 100644
index 0000000000..bef4bf3dc5
--- /dev/null
+++ b/test/test-network/conf/12-dummy-rename-to-altname.link
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+OriginalName=dummy98
+
+[Link]
+Name=dummyalt
+AlternativeName=dummyalt hogehogehogehogehogehoge
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 87710ef3fb..696618790a 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -936,6 +936,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()