Commit 12b0e7d0 authored by Xavier Thompson's avatar Xavier Thompson

software/theia: Add test for ipv6 range

parent 63cce30d
......@@ -34,6 +34,7 @@ import subprocess
import sqlite3
import time
import netaddr
import pexpect
import psutil
import requests
......@@ -241,6 +242,19 @@ class TestTheia(TheiaTestCase):
self.assertIn(b'slaprunner', self.captureSlapos('proxy', 'show'))
self.assertIn(b'slaprunner', self.captureSlapos('computer', 'list'))
def test_ipv6_range(self):
proxy_path = self.getPath('srv', 'runner', 'var', 'proxy.db')
query = "SELECT partition_reference, address FROM partition_network%s" % DB_VERSION
with sqlite3.connect(proxy_path) as db:
rows = db.execute(query).fetchall()
partitions = set(p for p, _ in rows)
ipv6 = set(addr for _, addr in rows if netaddr.valid_ipv6(addr))
# Check that each partition has a different IPv6
self.assertEqual(len(partitions), len(ipv6))
# Check that no partition has the same IPv6 as theia
self.assertNotIn(self.connection_parameters['ipv6'], ipv6)
class TestTheiaWithNonAsciiInstanceName(TestTheia):
default_partition_reference = '💥'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment