]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add tests for invalid Address sections
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 1 Mar 2019 06:21:22 +0000 (15:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Mar 2019 02:59:18 +0000 (11:59 +0900)
test/test-network/conf/25-address-section-miscellaneous.network
test/test-network/systemd-networkd-tests.py

index 3a37d036ce269f4b5a528744aaa903188481ca0f..bfb278f31f280b009efe1978dcbcc72318c6de71 100644 (file)
@@ -1,6 +1,11 @@
 [Match]
 Name=dummy98
 
+[Network]
+# these lines are ignored
+Address=hogehoge
+Address=foofoo
+
 [Address]
 Address=10.2.3.4/16
 PreferredLifetime=0
@@ -8,3 +13,15 @@ Scope=link
 
 [Address]
 Address=2001:0db8:0:f101::1/64
+
+[Address]
+# this section must be ignored
+Peer=hoge
+Address=10.10.0.1/16
+Label=30
+
+[Address]
+# this section must be ignored
+Label=30
+Peer=hoge
+Address=10.10.0.2/16
index 856960ad65f8d761f57b0adab3813fae2b07ff3e..ec8ed00c38bed16c523f6de44433c5c81b46081b 100755 (executable)
@@ -813,6 +813,9 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope link deprecated dummy98')
         self.assertRegex(output, 'inet6 2001:db8:0:f101::1/64 scope global')
+        # also tests invalid [Address] section
+        self.assertNotRegex(output, '10.10.0.1/16')
+        self.assertNotRegex(output, '10.10.0.2/16')
 
     def test_ip_route(self):
         self.copy_unit_to_networkd_unit_path('25-route-section.network', '12-dummy.netdev')