summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-06-01 14:23:03 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-06-01 14:23:03 +0900
commitda3509f0f5f68ae59cd403468746396617cd779b (patch)
tree41da90503063642f256e1f6150a75a364183fb4e
parent50254f55006b896639a14af1254536ce979a9810 (diff)
downloadsystemd-da3509f0f5f68ae59cd403468746396617cd779b.tar.gz
test-network: add test for wireguard without peers
-rw-r--r--test/test-network/conf/25-wireguard-no-peer.netdev8
-rw-r--r--test/test-network/conf/25-wireguard-no-peer.network2
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py13
3 files changed, 21 insertions, 2 deletions
diff --git a/test/test-network/conf/25-wireguard-no-peer.netdev b/test/test-network/conf/25-wireguard-no-peer.netdev
new file mode 100644
index 0000000000..13fd55d2fb
--- /dev/null
+++ b/test/test-network/conf/25-wireguard-no-peer.netdev
@@ -0,0 +1,8 @@
+[NetDev]
+Name=wg97
+Kind=wireguard
+
+[WireGuard]
+PrivateKey=EEGlnEPYJV//kbvvIqxKkQwOiS+UENyPncC4bF46ong=
+ListenPort=51821
+FwMark=1235
diff --git a/test/test-network/conf/25-wireguard-no-peer.network b/test/test-network/conf/25-wireguard-no-peer.network
new file mode 100644
index 0000000000..5c29d643f5
--- /dev/null
+++ b/test/test-network/conf/25-wireguard-no-peer.network
@@ -0,0 +1,2 @@
+[Match]
+Name=wg97
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 6dbc2b0c4f..78309d2651 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -746,6 +746,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'vtitun99',
'vxcan99',
'vxlan99',
+ 'wg97',
'wg98',
'wg99',
]
@@ -832,6 +833,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-vxlan.netdev',
'25-wireguard-23-peers.netdev',
'25-wireguard-23-peers.network',
+ '25-wireguard-no-peer.netdev',
+ '25-wireguard-no-peer.network',
'25-wireguard-preshared-key.txt',
'25-wireguard-private-key.txt',
'25-wireguard.netdev',
@@ -1115,9 +1118,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
def test_wireguard(self):
copy_unit_to_networkd_unit_path('25-wireguard.netdev', '25-wireguard.network',
'25-wireguard-23-peers.netdev', '25-wireguard-23-peers.network',
- '25-wireguard-preshared-key.txt', '25-wireguard-private-key.txt')
+ '25-wireguard-preshared-key.txt', '25-wireguard-private-key.txt',
+ '25-wireguard-no-peer.netdev', '25-wireguard-no-peer.network')
start_networkd()
- self.wait_online(['wg99:carrier', 'wg98:routable'])
+ self.wait_online(['wg99:carrier', 'wg98:routable', 'wg97:carrier'])
if shutil.which('wg'):
call('wg')
@@ -1142,6 +1146,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
output = check_output('wg show wg98 private-key')
self.assertRegex(output, r'CJQUtcS9emY2fLYqDlpSZiE/QJyHkPWr\+WHtZLZ90FU=')
+ output = check_output('wg show wg97 listen-port')
+ self.assertRegex(output, '51821')
+ output = check_output('wg show wg97 fwmark')
+ self.assertRegex(output, '0x4d3')
+
def test_geneve(self):
copy_unit_to_networkd_unit_path('25-geneve.netdev', 'netdev-link-local-addressing-yes.network')
start_networkd()