summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-03-01 15:21:22 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-03-13 11:59:18 +0900
commitbbb5aebe3e77842ab7c45f013def177fd3cd8abd (patch)
treea519ea46003b4ee5c0cf7f6a7d80938a0ba70f67 /test
parent96db641250e2692836badcf8eeb5e32fd7e189d4 (diff)
downloadsystemd-bbb5aebe3e77842ab7c45f013def177fd3cd8abd.tar.gz
test-network: add tests for invalid Address sections
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-address-section-miscellaneous.network17
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py3
2 files changed, 20 insertions, 0 deletions
diff --git a/test/test-network/conf/25-address-section-miscellaneous.network b/test/test-network/conf/25-address-section-miscellaneous.network
index 3a37d036ce..bfb278f31f 100644
--- a/test/test-network/conf/25-address-section-miscellaneous.network
+++ b/test/test-network/conf/25-address-section-miscellaneous.network
@@ -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
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 856960ad65..ec8ed00c38 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -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')