Skip to content

Commit

Permalink
tests: add some integration tests without the local address
Browse files Browse the repository at this point in the history
Copy a few tunnels common tests and remove the local address to ensure
both backends will work fine.
  • Loading branch information
Danilo Egea Gondolfo authored and daniloegea committed Sep 4, 2023
1 parent ed3aed3 commit a7e4be0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/integration/tunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ def test_tunnel_sit(self):
self.generate_and_settle(['sit-tun0'])
self.assert_iface('sit-tun0', ['sit-tun0@NONE', 'link.* 192.168.5.1 peer 99.99.99.99'])

def test_tunnel_sit_without_local_address(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'sit-tun0'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
version: 2
tunnels:
sit-tun0:
mode: sit
remote: 99.99.99.99
''' % {'r': self.backend})
self.generate_and_settle(['sit-tun0'])
self.assert_iface('sit-tun0', ['sit-tun0@NONE', 'link.* 0.0.0.0 peer 99.99.99.99'])

def test_tunnel_ipip(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'tun0'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
Expand All @@ -61,6 +75,21 @@ def test_tunnel_ipip(self):
self.generate_and_settle(['tun0'])
self.assert_iface('tun0', ['tun0@NONE', 'link.* 192.168.5.1 peer 99.99.99.99'])

def test_tunnel_ipip_without_local_address(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'tun0'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
version: 2
tunnels:
tun0:
mode: ipip
remote: 99.99.99.99
ttl: 64
''' % {'r': self.backend})
self.generate_and_settle(['tun0'])
self.assert_iface('tun0', ['tun0@NONE', 'link.* 0.0.0.0 peer 99.99.99.99'])

def test_tunnel_wireguard(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'wg0'], stderr=subprocess.DEVNULL)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'wg1'], stderr=subprocess.DEVNULL)
Expand Down Expand Up @@ -142,6 +171,20 @@ def test_tunnel_gre(self):
self.generate_and_settle(['tun0'])
self.assert_iface('tun0', ['tun0@NONE', 'link.* 192.168.5.1 peer 99.99.99.99'])

def test_tunnel_gre_without_local_address(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'tun0'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
version: 2
tunnels:
tun0:
mode: gre
remote: 99.99.99.99
''' % {'r': self.backend})
self.generate_and_settle(['tun0'])
self.assert_iface('tun0', ['tun0@NONE', 'link.* 0.0.0.0 peer 99.99.99.99'])

def test_tunnel_gre6(self):
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'tun0'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
Expand Down

0 comments on commit a7e4be0

Please sign in to comment.