1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

test-network: add test for wireguard without peers

This commit is contained in:
Yu Watanabe 2020-06-01 14:23:03 +09:00
parent 50254f5500
commit da3509f0f5
3 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,8 @@
[NetDev]
Name=wg97
Kind=wireguard
[WireGuard]
PrivateKey=EEGlnEPYJV//kbvvIqxKkQwOiS+UENyPncC4bF46ong=
ListenPort=51821
FwMark=1235

View File

@ -0,0 +1,2 @@
[Match]
Name=wg97

View File

@ -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()