Commit 21ca7da9 authored by Xavier Thompson's avatar Xavier Thompson

Fix tests when IPv6 range is available

See merge request !1413
parents fe60394b dacd6244
...@@ -45,7 +45,7 @@ class TestBackupServer(InstanceTestCase): ...@@ -45,7 +45,7 @@ class TestBackupServer(InstanceTestCase):
# Check that there is a RSS feed # Check that there is a RSS feed
self.assertTrue('rss' in parameter_dict) self.assertTrue('rss' in parameter_dict)
self.assertTrue(parameter_dict['rss'].startswith( self.assertTrue(parameter_dict['rss'].startswith(
f'https://[{self._ipv6_address}]:9443/' f'https://[{self.computer_partition_ipv6_address}]:9443/'
)) ))
result = requests.get( result = requests.get(
......
...@@ -47,7 +47,7 @@ class TestCaucase(SlapOSInstanceTestCase): ...@@ -47,7 +47,7 @@ class TestCaucase(SlapOSInstanceTestCase):
connection_parameter_dict = self.deserializeConnectionParameter() connection_parameter_dict = self.deserializeConnectionParameter()
self.assertEqual( self.assertEqual(
connection_parameter_dict, connection_parameter_dict,
{'url': 'http://[%s]:8009' % (self._ipv6_address,)} {'url': 'http://[%s]:8009' % (self.computer_partition_ipv6_address,)}
) )
result = requests.get(connection_parameter_dict['url']) result = requests.get(connection_parameter_dict['url'])
...@@ -57,14 +57,14 @@ class TestCaucase(SlapOSInstanceTestCase): ...@@ -57,14 +57,14 @@ class TestCaucase(SlapOSInstanceTestCase):
{ {
'_links': { '_links': {
'self': { 'self': {
'href': 'http://[%s]:8009' % (self._ipv6_address,) 'href': 'http://[%s]:8009' % (self.computer_partition_ipv6_address,)
}, },
'getCAUHAL': { 'getCAUHAL': {
'href': 'http://[%s]:8009//cau' % (self._ipv6_address,), 'href': 'http://[%s]:8009//cau' % (self.computer_partition_ipv6_address,),
'title': 'cau' 'title': 'cau'
}, },
'getCASHAL': { 'getCASHAL': {
'href': 'http://[%s]:8009//cas' % (self._ipv6_address,), 'href': 'http://[%s]:8009//cas' % (self.computer_partition_ipv6_address,),
'title': 'cas' 'title': 'cas'
} }
} }
......
...@@ -147,7 +147,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin): ...@@ -147,7 +147,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
param_dict = self.getRootPartitionConnectionParameterDict() param_dict = self.getRootPartitionConnectionParameterDict()
self.assertEqual( self.assertEqual(
'https://[%s]:8888/tree' % self._ipv6_address, 'https://[%s]:8888/tree' % self.computer_partition_ipv6_address,
param_dict['jupyter-url'] param_dict['jupyter-url']
) )
......
...@@ -138,7 +138,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin): ...@@ -138,7 +138,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
param_dict = self.getRootPartitionConnectionParameterDict() param_dict = self.getRootPartitionConnectionParameterDict()
self.assertEqual( self.assertEqual(
'https://[%s]:8888/tree' % self._ipv6_address, 'https://[%s]:8888/tree' % self.getPartitionIPv6(self.getPartitionId("jupyter")),
param_dict['jupyter-url'] param_dict['jupyter-url']
) )
......
...@@ -115,7 +115,7 @@ class WendelinTutorialTestCase(FluentdTestCase): ...@@ -115,7 +115,7 @@ class WendelinTutorialTestCase(FluentdTestCase):
round(random.uniform(-20, 50), 3))] round(random.uniform(-20, 50), 3))]
def serve(self, port, request_handler_class): def serve(self, port, request_handler_class):
server_address = (self._ipv6_address, port) server_address = (self.computer_partition_ipv6_address, port)
server = OneRequestServer(server_address, request_handler_class) server = OneRequestServer(server_address, request_handler_class)
data = server.get_first_data(FLUSH_INTERVAL) data = server.get_first_data(FLUSH_INTERVAL)
...@@ -181,7 +181,7 @@ class SensorConfTestCase(WendelinTutorialTestCase): ...@@ -181,7 +181,7 @@ class SensorConfTestCase(WendelinTutorialTestCase):
@type forward @type forward
<server> <server>
name myserver1 name myserver1
host {cls._ipv6_address} host {cls.computer_partition_ipv6_address}
</server> </server>
<buffer> <buffer>
flush_mode immediate flush_mode immediate
...@@ -199,7 +199,7 @@ print("{measurement_text}")''' ...@@ -199,7 +199,7 @@ print("{measurement_text}")'''
def test_configuration(self): def test_configuration(self):
self._test_configuration( self._test_configuration(
fr'adding forwarding server \'myserver1\' host="{self._ipv6_address}" port={FLUENTD_PORT} weight=60' fr'adding forwarding server \'myserver1\' host="{self.computer_partition_ipv6_address}" port={FLUENTD_PORT} weight=60'
) )
def test_send_data(self): def test_send_data(self):
...@@ -232,11 +232,11 @@ class GatewayConfTestCase(WendelinTutorialTestCase): ...@@ -232,11 +232,11 @@ class GatewayConfTestCase(WendelinTutorialTestCase):
<source> <source>
@type forward @type forward
port {fluentd_port} port {fluentd_port}
bind {cls._ipv6_address} bind {cls.computer_partition_ipv6_address}
</source> </source>
<match tag.name> <match tag.name>
@type wendelin @type wendelin
streamtool_uri http://[{cls._ipv6_address}]:{wendelin_port}/erp5/portal_ingestion_policies/default streamtool_uri http://[{cls.computer_partition_ipv6_address}]:{wendelin_port}/erp5/portal_ingestion_policies/default
user foo user foo
password bar password bar
<buffer> <buffer>
...@@ -249,9 +249,9 @@ class GatewayConfTestCase(WendelinTutorialTestCase): ...@@ -249,9 +249,9 @@ class GatewayConfTestCase(WendelinTutorialTestCase):
@classmethod @classmethod
def get_configuration(cls): def get_configuration(cls):
fluentd_port = findFreeTCPPort(cls._ipv6_address) fluentd_port = findFreeTCPPort(cls.computer_partition_ipv6_address)
cls._fluentd_port = fluentd_port cls._fluentd_port = fluentd_port
wendelin_port = findFreeTCPPort(cls._ipv6_address) wendelin_port = findFreeTCPPort(cls.computer_partition_ipv6_address)
cls._wendelin_port = wendelin_port cls._wendelin_port = wendelin_port
return cls.gateway_conf(fluentd_port, wendelin_port) return cls.gateway_conf(fluentd_port, wendelin_port)
...@@ -260,7 +260,7 @@ class GatewayConfTestCase(WendelinTutorialTestCase): ...@@ -260,7 +260,7 @@ class GatewayConfTestCase(WendelinTutorialTestCase):
def test_wendelin_data_forwarding(self): def test_wendelin_data_forwarding(self):
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
sock.connect((self._ipv6_address, self._fluentd_port)) sock.connect((self.computer_partition_ipv6_address, self._fluentd_port))
data = [ data = [
msgpack.ExtType(0, struct.pack('!Q', int(time.time()) << 32)), msgpack.ExtType(0, struct.pack('!Q', int(time.time()) << 32)),
......
...@@ -319,7 +319,7 @@ class TestListenInPartition(GrafanaTestCase): ...@@ -319,7 +319,7 @@ class TestListenInPartition(GrafanaTestCase):
c.laddr for c in self.process_dict['grafana'].connections() c.laddr for c in self.process_dict['grafana'].connections()
if c.status == 'LISTEN' if c.status == 'LISTEN'
], ],
[(self._ipv6_address, 8180)], [(self.computer_partition_ipv6_address, 8180)],
) )
def test_influxdb_listen(self): def test_influxdb_listen(self):
...@@ -330,7 +330,7 @@ class TestListenInPartition(GrafanaTestCase): ...@@ -330,7 +330,7 @@ class TestListenInPartition(GrafanaTestCase):
]), ]),
[ [
(self._ipv4_address, 8088), (self._ipv4_address, 8088),
(self._ipv6_address, 8086), (self.computer_partition_ipv6_address, 8086),
], ],
) )
......
...@@ -43,7 +43,7 @@ class TestHtmlValidatorServer(InstanceTestCase): ...@@ -43,7 +43,7 @@ class TestHtmlValidatorServer(InstanceTestCase):
self.assertTrue('vnu-url' in parameter_dict) self.assertTrue('vnu-url' in parameter_dict)
self.assertEqual( self.assertEqual(
'https://[%s]:8899/' % (self._ipv6_address, ), 'https://[%s]:8899/' % (self.computer_partition_ipv6_address, ),
parameter_dict['vnu-url'] parameter_dict['vnu-url']
) )
......
...@@ -52,7 +52,7 @@ class TestJSTestNode(InstanceTestCase): ...@@ -52,7 +52,7 @@ class TestJSTestNode(InstanceTestCase):
self.assertEqual( self.assertEqual(
{ {
'nginx': 'http://[%s]:9443/' % (self._ipv6_address, ) 'nginx': 'http://[%s]:9443/' % (self.computer_partition_ipv6_address, )
}, },
connection_dict connection_dict
) )
...@@ -83,7 +83,7 @@ class TestJSTestNode(InstanceTestCase): ...@@ -83,7 +83,7 @@ class TestJSTestNode(InstanceTestCase):
# Default access # Default access
result = requests.get( result = requests.get(
'http://[%s]:9443' % (self._ipv6_address, ), allow_redirects=False) 'http://[%s]:9443' % (self.computer_partition_ipv6_address, ), allow_redirects=False)
self.assertEqual( self.assertEqual(
[requests.codes.forbidden, False], [requests.codes.forbidden, False],
[result.status_code, result.is_redirect] [result.status_code, result.is_redirect]
......
...@@ -52,10 +52,10 @@ class TestJupyter(InstanceTestCase): ...@@ -52,10 +52,10 @@ class TestJupyter(InstanceTestCase):
self.assertEqual( self.assertEqual(
{ {
'jupyter-classic-url': 'https://[%s]:8888/tree' % (self._ipv6_address, ), 'jupyter-classic-url': 'https://[%s]:8888/tree' % (self.computer_partition_ipv6_address, ),
'jupyterlab-url': 'https://[%s]:8888/lab' % (self._ipv6_address, ), 'jupyterlab-url': 'https://[%s]:8888/lab' % (self.computer_partition_ipv6_address, ),
'password': '%s' % (password, ), 'password': '%s' % (password, ),
'url': 'https://[%s]:8888/tree' % (self._ipv6_address, ) 'url': 'https://[%s]:8888/tree' % (self.computer_partition_ipv6_address, )
}, },
connection_dict connection_dict
) )
......
...@@ -115,6 +115,46 @@ bootstrap_machine_param_dict = { ...@@ -115,6 +115,46 @@ bootstrap_machine_param_dict = {
} }
class KVMTestCase(InstanceTestCase):
@classmethod
def _findTopLevelPartitionPath(cls, path):
index = 0
while True:
index = path.find(os.path.sep, index) + len(os.path.sep)
top_path = path[:index]
if os.path.exists(os.path.join(top_path, '.slapos-resource')):
return top_path
if index == -1:
return None
@classmethod
def _updateSlaposResource(cls, partition_path, **kw):
with open(os.path.join(partition_path, '.slapos-resource'), 'r+') as f:
resource = json.load(f)
resource.update(kw)
f.seek(0)
f.truncate()
json.dump(resource, f, indent=2)
@classmethod
def formatPartitions(cls):
super().formatPartitions()
# steal tap from top level partition
instance_directory = cls.slap.instance_directory
top_partition_path = cls._findTopLevelPartitionPath(instance_directory)
with open(os.path.join(top_partition_path, '.slapos-resource')) as f:
top_resource = json.load(f)
for partition in os.listdir(instance_directory):
if not partition.startswith(cls.__partition_reference__):
continue
partition_path = os.path.join(instance_directory, partition)
cls._updateSlaposResource(partition_path, tap=top_resource['tap'])
class KvmMixin: class KvmMixin:
def getConnectionParameterDictJson(self): def getConnectionParameterDictJson(self):
return json.loads( return json.loads(
...@@ -176,7 +216,7 @@ class KvmMixinJson: ...@@ -176,7 +216,7 @@ class KvmMixinJson:
@skipUnlessKvm @skipUnlessKvm
class TestInstance(InstanceTestCase, KvmMixin): class TestInstance(KVMTestCase, KvmMixin):
__partition_reference__ = 'i' __partition_reference__ = 'i'
def test(self): def test(self):
...@@ -192,12 +232,12 @@ class TestInstance(InstanceTestCase, KvmMixin): ...@@ -192,12 +232,12 @@ class TestInstance(InstanceTestCase, KvmMixin):
self.assertEqual( self.assertEqual(
connection_parameter_dict, connection_parameter_dict,
{ {
'ipv6': self._ipv6_address, 'ipv6': self.computer_partition_ipv6_address,
'maximum-extra-disk-amount': '0', 'maximum-extra-disk-amount': '0',
'monitor-base-url': f'https://[{self._ipv6_address}]:8026', 'monitor-base-url': f'https://[{self.computer_partition_ipv6_address}]:8026',
'nat-rule-port-tcp-22': f'{self._ipv6_address} : 10022', 'nat-rule-port-tcp-22': f'{self.computer_partition_ipv6_address} : 10022',
'nat-rule-port-tcp-443': f'{self._ipv6_address} : 10443', 'nat-rule-port-tcp-443': f'{self.computer_partition_ipv6_address} : 10443',
'nat-rule-port-tcp-80': f'{self._ipv6_address} : 10080', 'nat-rule-port-tcp-80': f'{self.computer_partition_ipv6_address} : 10080',
} }
) )
self.assertEqual(set(present_key_list), set(assert_key_list)) self.assertEqual(set(present_key_list), set(assert_key_list))
...@@ -227,7 +267,7 @@ class TestInstanceJson( ...@@ -227,7 +267,7 @@ class TestInstanceJson(
@skipUnlessKvm @skipUnlessKvm
class TestMemoryManagement(InstanceTestCase, KvmMixin): class TestMemoryManagement(KVMTestCase, KvmMixin):
__partition_reference__ = 'i' __partition_reference__ = 'i'
def getKvmProcessInfo(self, switch_list): def getKvmProcessInfo(self, switch_list):
...@@ -395,7 +435,7 @@ class MonitorAccessMixin(KvmMixin): ...@@ -395,7 +435,7 @@ class MonitorAccessMixin(KvmMixin):
@skipUnlessKvm @skipUnlessKvm
class TestAccessDefault(MonitorAccessMixin, InstanceTestCase): class TestAccessDefault(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'ad' __partition_reference__ = 'ad'
expected_partition_with_monitor_base_url_count = 1 expected_partition_with_monitor_base_url_count = 1
...@@ -416,7 +456,7 @@ class TestAccessDefaultJson(KvmMixinJson, TestAccessDefault): ...@@ -416,7 +456,7 @@ class TestAccessDefaultJson(KvmMixinJson, TestAccessDefault):
@skipUnlessKvm @skipUnlessKvm
class TestAccessDefaultAdditional(MonitorAccessMixin, InstanceTestCase): class TestAccessDefaultAdditional(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'ada' __partition_reference__ = 'ada'
expected_partition_with_monitor_base_url_count = 1 expected_partition_with_monitor_base_url_count = 1
...@@ -452,7 +492,7 @@ class TestAccessDefaultAdditionalJson( ...@@ -452,7 +492,7 @@ class TestAccessDefaultAdditionalJson(
@skipUnlessKvm @skipUnlessKvm
class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase): class TestAccessDefaultBootstrap(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'adb' __partition_reference__ = 'adb'
expected_partition_with_monitor_base_url_count = 1 expected_partition_with_monitor_base_url_count = 1
...@@ -464,27 +504,22 @@ class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase): ...@@ -464,27 +504,22 @@ class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase):
def test(self): def test(self):
# START: mock .slapos-resource with tap.ipv4_addr # START: mock .slapos-resource with tap.ipv4_addr
# needed for netconfig.sh # needed for netconfig.sh
test_partition_slapos_resource_file = os.path.join( partition_path = self.computer_partition_root_path
self.computer_partition_root_path, '.slapos-resource') top_partition_path = self._findTopLevelPartitionPath(partition_path)
path = os.path.realpath(os.curdir)
while path != '/': with open(os.path.join(top_partition_path, '.slapos-resource')) as f:
root_slapos_resource_file = os.path.join(path, '.slapos-resource') top_tap = json.load(f)['tap']
if os.path.exists(root_slapos_resource_file):
break if top_tap['ipv4_addr'] == '':
path = os.path.realpath(os.path.join(path, '..')) top_tap.update({
else:
raise ValueError('No .slapos-resource found to base the mock on')
with open(root_slapos_resource_file) as fh:
root_slapos_resource = json.load(fh)
if root_slapos_resource['tap']['ipv4_addr'] == '':
root_slapos_resource['tap'].update({
"ipv4_addr": "10.0.0.2", "ipv4_addr": "10.0.0.2",
"ipv4_gateway": "10.0.0.1", "ipv4_gateway": "10.0.0.1",
"ipv4_netmask": "255.255.0.0", "ipv4_netmask": "255.255.0.0",
"ipv4_network": "10.0.0.0" "ipv4_network": "10.0.0.0"
}) })
with open(test_partition_slapos_resource_file, 'w') as fh:
json.dump(root_slapos_resource, fh, indent=4) self._updateSlaposResource(partition_path, tap=top_tap)
self.slap.waitForInstance(max_retry=10) self.slap.waitForInstance(max_retry=10)
# END: mock .slapos-resource with tap.ipv4_addr # END: mock .slapos-resource with tap.ipv4_addr
...@@ -505,7 +540,7 @@ class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase): ...@@ -505,7 +540,7 @@ class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase):
@skipUnlessKvm @skipUnlessKvm
class TestAccessKvmCluster(MonitorAccessMixin, InstanceTestCase): class TestAccessKvmCluster(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'akc' __partition_reference__ = 'akc'
expected_partition_with_monitor_base_url_count = 2 expected_partition_with_monitor_base_url_count = 2
...@@ -535,7 +570,7 @@ class TestAccessKvmCluster(MonitorAccessMixin, InstanceTestCase): ...@@ -535,7 +570,7 @@ class TestAccessKvmCluster(MonitorAccessMixin, InstanceTestCase):
@skipUnlessKvm @skipUnlessKvm
class TestAccessKvmClusterAdditional(MonitorAccessMixin, InstanceTestCase): class TestAccessKvmClusterAdditional(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'akca' __partition_reference__ = 'akca'
expected_partition_with_monitor_base_url_count = 2 expected_partition_with_monitor_base_url_count = 2
...@@ -575,7 +610,7 @@ class TestAccessKvmClusterAdditional(MonitorAccessMixin, InstanceTestCase): ...@@ -575,7 +610,7 @@ class TestAccessKvmClusterAdditional(MonitorAccessMixin, InstanceTestCase):
@skipUnlessKvm @skipUnlessKvm
class TestAccessKvmClusterBootstrap(MonitorAccessMixin, InstanceTestCase): class TestAccessKvmClusterBootstrap(MonitorAccessMixin, KVMTestCase):
__partition_reference__ = 'akcb' __partition_reference__ = 'akcb'
expected_partition_with_monitor_base_url_count = 3 expected_partition_with_monitor_base_url_count = 3
...@@ -618,7 +653,7 @@ class TestAccessKvmClusterBootstrap(MonitorAccessMixin, InstanceTestCase): ...@@ -618,7 +653,7 @@ class TestAccessKvmClusterBootstrap(MonitorAccessMixin, InstanceTestCase):
@skipUnlessKvm @skipUnlessKvm
class TestInstanceResilient(InstanceTestCase, KvmMixin): class TestInstanceResilient(KVMTestCase, KvmMixin):
__partition_reference__ = 'ir' __partition_reference__ = 'ir'
instance_max_retry = 20 instance_max_retry = 20
...@@ -626,6 +661,13 @@ class TestInstanceResilient(InstanceTestCase, KvmMixin): ...@@ -626,6 +661,13 @@ class TestInstanceResilient(InstanceTestCase, KvmMixin):
def getInstanceSoftwareType(cls): def getInstanceSoftwareType(cls):
return 'kvm-resilient' return 'kvm-resilient'
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.pbs1_ipv6 = cls.getPartitionIPv6(cls.getPartitionId('PBS (kvm / 1)'))
cls.kvm0_ipv6 = cls.getPartitionIPv6(cls.getPartitionId('kvm0'))
cls.kvm1_ipv6 = cls.getPartitionIPv6(cls.getPartitionId('kvm1'))
def test_kvm_exporter(self): def test_kvm_exporter(self):
exporter_partition = os.path.join( exporter_partition = os.path.join(
self.slap.instance_directory, self.slap.instance_directory,
...@@ -661,19 +703,19 @@ class TestInstanceResilient(InstanceTestCase, KvmMixin): ...@@ -661,19 +703,19 @@ class TestInstanceResilient(InstanceTestCase, KvmMixin):
self.assertRegex( self.assertRegex(
feed_pull, feed_pull,
'http://\\[{}\\]:[0-9][0-9][0-9][0-9]/get/local-ir0-kvm-1-pull'.format( 'http://\\[{}\\]:[0-9][0-9][0-9][0-9]/get/local-ir0-kvm-1-pull'.format(
self._ipv6_address)) self.pbs1_ipv6))
feed_push = connection_parameter_dict.pop('feed-url-kvm-1-push') feed_push = connection_parameter_dict.pop('feed-url-kvm-1-push')
self.assertRegex( self.assertRegex(
feed_push, feed_push,
'http://\\[{}\\]:[0-9][0-9][0-9][0-9]/get/local-ir0-kvm-1-push'.format( 'http://\\[{}\\]:[0-9][0-9][0-9][0-9]/get/local-ir0-kvm-1-push'.format(
self._ipv6_address)) self.pbs1_ipv6))
self.assertEqual( self.assertEqual(
connection_parameter_dict, connection_parameter_dict,
{ {
'ipv6': self._ipv6_address, 'ipv6': self.kvm0_ipv6,
'monitor-base-url': f'https://[{self._ipv6_address}]:8160', 'monitor-base-url': f'https://[{self.computer_partition_ipv6_address}]:8160',
'monitor-user': 'admin', 'monitor-user': 'admin',
'takeover-kvm-1-url': f'http://[{self._ipv6_address}]:9263/', 'takeover-kvm-1-url': f'http://[{self.kvm1_ipv6}]:9263/',
} }
) )
self.assertEqual(set(present_key_list), set(assert_key_list)) self.assertEqual(set(present_key_list), set(assert_key_list))
...@@ -733,7 +775,7 @@ class TestInstanceResilientJson( ...@@ -733,7 +775,7 @@ class TestInstanceResilientJson(
@skipUnlessKvm @skipUnlessKvm
class TestInstanceResilientDiskTypeIde(InstanceTestCase, KvmMixin): class TestInstanceResilientDiskTypeIde(KVMTestCase, KvmMixin):
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
return { return {
...@@ -748,7 +790,7 @@ class TestInstanceResilientDiskTypeIdeJson( ...@@ -748,7 +790,7 @@ class TestInstanceResilientDiskTypeIdeJson(
@skipUnlessKvm @skipUnlessKvm
class TestAccessResilientAdditional(InstanceTestCase): class TestAccessResilientAdditional(KVMTestCase):
__partition_reference__ = 'ara' __partition_reference__ = 'ara'
expected_partition_with_monitor_base_url_count = 1 expected_partition_with_monitor_base_url_count = 1
...@@ -788,7 +830,7 @@ class TestAccessResilientAdditionalJson( ...@@ -788,7 +830,7 @@ class TestAccessResilientAdditionalJson(
pass pass
class TestInstanceNbdServer(InstanceTestCase): class TestInstanceNbdServer(KVMTestCase):
__partition_reference__ = 'ins' __partition_reference__ = 'ins'
instance_max_retry = 5 instance_max_retry = 5
...@@ -890,7 +932,7 @@ class FakeImageServerMixin(KvmMixin): ...@@ -890,7 +932,7 @@ class FakeImageServerMixin(KvmMixin):
@skipUnlessKvm @skipUnlessKvm
class TestBootImageUrlList(InstanceTestCase, FakeImageServerMixin): class TestBootImageUrlList(KVMTestCase, FakeImageServerMixin):
__partition_reference__ = 'biul' __partition_reference__ = 'biul'
kvm_instance_partition_reference = 'biul0' kvm_instance_partition_reference = 'biul0'
...@@ -1250,7 +1292,7 @@ class TestBootImageUrlSelectResilientJson( ...@@ -1250,7 +1292,7 @@ class TestBootImageUrlSelectResilientJson(
@skipUnlessKvm @skipUnlessKvm
class TestBootImageUrlListKvmCluster(InstanceTestCase, FakeImageServerMixin): class TestBootImageUrlListKvmCluster(KVMTestCase, FakeImageServerMixin):
__partition_reference__ = 'biulkc' __partition_reference__ = 'biulkc'
@classmethod @classmethod
...@@ -1328,7 +1370,7 @@ class TestBootImageUrlSelectKvmCluster(TestBootImageUrlListKvmCluster): ...@@ -1328,7 +1370,7 @@ class TestBootImageUrlSelectKvmCluster(TestBootImageUrlListKvmCluster):
@skipUnlessKvm @skipUnlessKvm
class TestNatRules(KvmMixin, InstanceTestCase): class TestNatRules(KvmMixin, KVMTestCase):
__partition_reference__ = 'nr' __partition_reference__ = 'nr'
@classmethod @classmethod
...@@ -1344,11 +1386,11 @@ class TestNatRules(KvmMixin, InstanceTestCase): ...@@ -1344,11 +1386,11 @@ class TestNatRules(KvmMixin, InstanceTestCase):
self.assertIn('nat-rule-port-tcp-200', connection_parameter_dict) self.assertIn('nat-rule-port-tcp-200', connection_parameter_dict)
self.assertEqual( self.assertEqual(
f'{self._ipv6_address} : 10100', f'{self.computer_partition_ipv6_address} : 10100',
connection_parameter_dict['nat-rule-port-tcp-100'] connection_parameter_dict['nat-rule-port-tcp-100']
) )
self.assertEqual( self.assertEqual(
f'{self._ipv6_address} : 10200', f'{self.computer_partition_ipv6_address} : 10200',
connection_parameter_dict['nat-rule-port-tcp-200'] connection_parameter_dict['nat-rule-port-tcp-200']
) )
...@@ -1360,7 +1402,7 @@ class TestNatRulesJson( ...@@ -1360,7 +1402,7 @@ class TestNatRulesJson(
@skipUnlessKvm @skipUnlessKvm
class TestNatRulesKvmCluster(InstanceTestCase): class TestNatRulesKvmCluster(KVMTestCase):
__partition_reference__ = 'nrkc' __partition_reference__ = 'nrkc'
nat_rules = ["100", "200", "300"] nat_rules = ["100", "200", "300"]
...@@ -1409,7 +1451,7 @@ class TestNatRulesKvmClusterComplex(TestNatRulesKvmCluster): ...@@ -1409,7 +1451,7 @@ class TestNatRulesKvmClusterComplex(TestNatRulesKvmCluster):
@skipUnlessKvm @skipUnlessKvm
class TestWhitelistFirewall(InstanceTestCase): class TestWhitelistFirewall(KVMTestCase):
__partition_reference__ = 'wf' __partition_reference__ = 'wf'
kvm_instance_partition_reference = 'wf0' kvm_instance_partition_reference = 'wf0'
...@@ -1537,7 +1579,7 @@ class TestWhitelistFirewallRequestCluster(TestWhitelistFirewallRequest): ...@@ -1537,7 +1579,7 @@ class TestWhitelistFirewallRequestCluster(TestWhitelistFirewallRequest):
@skipUnlessKvm @skipUnlessKvm
class TestDiskDevicePathWipeDiskOndestroy(InstanceTestCase, KvmMixin): class TestDiskDevicePathWipeDiskOndestroy(KVMTestCase, KvmMixin):
__partition_reference__ = 'ddpwdo' __partition_reference__ = 'ddpwdo'
kvm_instance_partition_reference = 'ddpwdo0' kvm_instance_partition_reference = 'ddpwdo0'
...@@ -1572,7 +1614,7 @@ class TestDiskDevicePathWipeDiskOndestroyJson( ...@@ -1572,7 +1614,7 @@ class TestDiskDevicePathWipeDiskOndestroyJson(
@skipUnlessKvm @skipUnlessKvm
class TestImageDownloadController(InstanceTestCase, FakeImageServerMixin): class TestImageDownloadController(KVMTestCase, FakeImageServerMixin):
__partition_reference__ = 'idc' __partition_reference__ = 'idc'
maxDiff = None maxDiff = None
...@@ -1774,7 +1816,7 @@ INF: Storing errors in %(error_state_file)s ...@@ -1774,7 +1816,7 @@ INF: Storing errors in %(error_state_file)s
@skipUnlessKvm @skipUnlessKvm
class TestParameterDefault(InstanceTestCase, KvmMixin): class TestParameterDefault(KVMTestCase, KvmMixin):
__partition_reference__ = 'pd' __partition_reference__ = 'pd'
@classmethod @classmethod
...@@ -1883,22 +1925,17 @@ class ExternalDiskMixin(KvmMixin): ...@@ -1883,22 +1925,17 @@ class ExternalDiskMixin(KvmMixin):
def _prepareExternalStorageList(cls): def _prepareExternalStorageList(cls):
external_storage_path = os.path.join(cls.working_directory, 'STORAGE') external_storage_path = os.path.join(cls.working_directory, 'STORAGE')
os.mkdir(external_storage_path) os.mkdir(external_storage_path)
# reuse .slapos-resource infomration of the containing partition
# it's similar to slapos/recipe/slapconfiguration.py
_resource_home = cls.slap.instance_directory
parent_slapos_resource = None
while not os.path.exists(os.path.join(_resource_home, '.slapos-resource')):
_resource_home = os.path.normpath(os.path.join(_resource_home, '..'))
if _resource_home == "/":
break
else:
with open(os.path.join(_resource_home, '.slapos-resource')) as fh:
parent_slapos_resource = json.load(fh)
assert parent_slapos_resource is not None
for partition in os.listdir(cls.slap.instance_directory): # We already reuse tap from top level partition
instance_directory = cls.slap.instance_directory
for partition in os.listdir(instance_directory):
if not partition.startswith(cls.__partition_reference__): if not partition.startswith(cls.__partition_reference__):
continue continue
partition_path = os.path.join(instance_directory, partition)
partition_store_list = [] partition_store_list = []
for number in range(10): for number in range(10):
storage = os.path.join(external_storage_path, f'data{number}') storage = os.path.join(external_storage_path, f'data{number}')
...@@ -1907,13 +1944,12 @@ class ExternalDiskMixin(KvmMixin): ...@@ -1907,13 +1944,12 @@ class ExternalDiskMixin(KvmMixin):
partition_store = os.path.join(storage, partition) partition_store = os.path.join(storage, partition)
os.mkdir(partition_store) os.mkdir(partition_store)
partition_store_list.append(partition_store) partition_store_list.append(partition_store)
slapos_resource = parent_slapos_resource.copy()
slapos_resource['external_storage_list'] = partition_store_list cls._updateSlaposResource(
with open( partition_path,
os.path.join( external_storage_list=partition_store_list,
cls.slap.instance_directory, partition, '.slapos-resource'), )
'w') as fh:
json.dump(slapos_resource, fh, indent=2)
# above is not enough: the presence of parameter is required in slapos.cfg # above is not enough: the presence of parameter is required in slapos.cfg
slapos_config = [] slapos_config = []
with open(cls.slap._slapos_config) as fh: with open(cls.slap._slapos_config) as fh:
...@@ -1955,7 +1991,7 @@ class ExternalDiskMixin(KvmMixin): ...@@ -1955,7 +1991,7 @@ class ExternalDiskMixin(KvmMixin):
@skipUnlessKvm @skipUnlessKvm
class TestExternalDisk(InstanceTestCase, ExternalDiskMixin): class TestExternalDisk(KVMTestCase, ExternalDiskMixin):
__partition_reference__ = 'ed' __partition_reference__ = 'ed'
kvm_instance_partition_reference = 'ed0' kvm_instance_partition_reference = 'ed0'
...@@ -2105,7 +2141,7 @@ class ExternalDiskModernMixin(object): ...@@ -2105,7 +2141,7 @@ class ExternalDiskModernMixin(object):
@skipUnlessKvm @skipUnlessKvm
class TestExternalDiskModern( class TestExternalDiskModern(
ExternalDiskModernMixin, InstanceTestCase, ExternalDiskMixin): ExternalDiskModernMixin, KVMTestCase, ExternalDiskMixin):
def test(self): def test(self):
self.prepareEnv() self.prepareEnv()
self.waitForInstance() self.waitForInstance()
...@@ -2126,7 +2162,7 @@ class TestExternalDiskModern( ...@@ -2126,7 +2162,7 @@ class TestExternalDiskModern(
@skipUnlessKvm @skipUnlessKvm
class TestExternalDiskModernConflictAssurance( class TestExternalDiskModernConflictAssurance(
ExternalDiskModernMixin, InstanceTestCase, ExternalDiskMixin): ExternalDiskModernMixin, KVMTestCase, ExternalDiskMixin):
def test(self): def test(self):
self.prepareEnv() self.prepareEnv()
# Create conflicting configuration # Create conflicting configuration
...@@ -2186,7 +2222,7 @@ class TestExternalDiskModernCluster(TestExternalDiskModern): ...@@ -2186,7 +2222,7 @@ class TestExternalDiskModernCluster(TestExternalDiskModern):
@skipUnlessKvm @skipUnlessKvm
class TestExternalDiskModernIndexRequired(InstanceTestCase, ExternalDiskMixin): class TestExternalDiskModernIndexRequired(KVMTestCase, ExternalDiskMixin):
__partition_reference__ = 'edm' __partition_reference__ = 'edm'
kvm_instance_partition_reference = 'edm0' kvm_instance_partition_reference = 'edm0'
...@@ -2250,7 +2286,7 @@ class TestExternalDiskModernIndexRequired(InstanceTestCase, ExternalDiskMixin): ...@@ -2250,7 +2286,7 @@ class TestExternalDiskModernIndexRequired(InstanceTestCase, ExternalDiskMixin):
@skipUnlessKvm @skipUnlessKvm
class TestInstanceHttpServer(InstanceTestCase, KvmMixin): class TestInstanceHttpServer(KVMTestCase, KvmMixin):
__partition_reference__ = 'ihs' __partition_reference__ = 'ihs'
@classmethod @classmethod
...@@ -2328,12 +2364,12 @@ vm""", ...@@ -2328,12 +2364,12 @@ vm""",
self.assertEqual( self.assertEqual(
connection_parameter_dict, connection_parameter_dict,
{ {
'ipv6': self._ipv6_address, 'ipv6': self.computer_partition_ipv6_address,
'maximum-extra-disk-amount': '0', 'maximum-extra-disk-amount': '0',
'monitor-base-url': f'https://[{self._ipv6_address}]:8026', 'monitor-base-url': f'https://[{self.computer_partition_ipv6_address}]:8026',
'nat-rule-port-tcp-22': f'{self._ipv6_address} : 10022', 'nat-rule-port-tcp-22': f'{self.computer_partition_ipv6_address} : 10022',
'nat-rule-port-tcp-443': f'{self._ipv6_address} : 10443', 'nat-rule-port-tcp-443': f'{self.computer_partition_ipv6_address} : 10443',
'nat-rule-port-tcp-80': f'{self._ipv6_address} : 10080', 'nat-rule-port-tcp-80': f'{self.computer_partition_ipv6_address} : 10080',
} }
) )
self.assertEqual(set(present_key_list), set(assert_key_list)) self.assertEqual(set(present_key_list), set(assert_key_list))
......
...@@ -65,6 +65,10 @@ class NextCloudTestCase(InstanceTestCase): ...@@ -65,6 +65,10 @@ class NextCloudTestCase(InstanceTestCase):
self.nextcloud_path, self.nextcloud_path,
"Nextcloud path not found in %r" % (partition_path_list,)) "Nextcloud path not found in %r" % (partition_path_list,))
# lookup nextcloud partition ipv6
partition_id = os.path.basename(self.partition_dir)
self.nextcloud_ipv6 = self.getPartitionIPv6(partition_id)
# parse database info from mariadb url # parse database info from mariadb url
d = self.computer_partition.getConnectionParameterDict() d = self.computer_partition.getConnectionParameterDict()
db_url = d['mariadb-url-list'][2:-2] # parse <url> out of "['<url>']" db_url = d['mariadb-url-list'][2:-2] # parse <url> out of "['<url>']"
...@@ -86,9 +90,9 @@ class NextCloudTestCase(InstanceTestCase): ...@@ -86,9 +90,9 @@ class NextCloudTestCase(InstanceTestCase):
mail_smtpport="587", mail_smtpport="587",
mail_smtppassword="", mail_smtppassword="",
mail_smtpname="", mail_smtpname="",
cli_url="https://[%s]:9988/" % self._ipv6_address, cli_url="https://[%s]:9988/" % self.nextcloud_ipv6,
partition_dir=self.partition_dir, partition_dir=self.partition_dir,
trusted_domain_list=json.dumps(["[%s]:9988" % self._ipv6_address]), trusted_domain_list=json.dumps(["[%s]:9988" % self.nextcloud_ipv6]),
trusted_proxy_list=[], trusted_proxy_list=[],
) )
data_dict.update(config_dict) data_dict.update(config_dict)
...@@ -336,7 +340,7 @@ class TestNextCloudParameters(NextCloudTestCase): ...@@ -336,7 +340,7 @@ class TestNextCloudParameters(NextCloudTestCase):
cli_url="nextcloud.example.com", cli_url="nextcloud.example.com",
partition_dir=self.partition_dir, partition_dir=self.partition_dir,
trusted_domain_list=json.dumps([ trusted_domain_list=json.dumps([
"[%s]:9988" % self._ipv6_address, "[%s]:9988" % self.nextcloud_ipv6,
"nextcloud.example.com", "nextcloud.example.com",
"nextcloud.proxy.com" "nextcloud.proxy.com"
]), ]),
......
...@@ -37,7 +37,6 @@ import urllib ...@@ -37,7 +37,6 @@ import urllib
from slapos.recipe.librecipe import generateHashFromFiles from slapos.recipe.librecipe import generateHashFromFiles
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
skip = unittest.skip('port conflit between powerdns instances') skip = unittest.skip('port conflit between powerdns instances')
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass( setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
...@@ -93,9 +92,10 @@ class PowerDNSTestCase(SlapOSInstanceTestCase): ...@@ -93,9 +92,10 @@ class PowerDNSTestCase(SlapOSInstanceTestCase):
ns_record = [] ns_record = []
for replicate_nb in range(1, dns_quantity + 1): for replicate_nb in range(1, dns_quantity + 1):
ns_id = 'ns%s' % replicate_nb ns_id = 'ns%s' % replicate_nb
partition_id = self.getPartitionId(ns_id)
ns_record.append(ns_id + '.' + self.default_supported_zone) ns_record.append(ns_id + '.' + self.default_supported_zone)
expected_dict[ns_id + '-port'] = str(DNS_PORT) expected_dict[ns_id + '-port'] = str(DNS_PORT)
expected_dict[ns_id + '-ipv6'] = self._ipv6_address expected_dict[ns_id + '-ipv6'] = self.getPartitionIPv6(partition_id)
expected_dict['ns-record'] = ','.join(ns_record) expected_dict['ns-record'] = ','.join(ns_record)
expected_dict['slave-amount'] = str(slave_amount) expected_dict['slave-amount'] = str(slave_amount)
...@@ -199,11 +199,11 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase): ...@@ -199,11 +199,11 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase):
).getConnectionParameterDict()) ).getConnectionParameterDict())
return parameter_dict_list return parameter_dict_list
def dns_query(self, domain_name, subnet): def dns_query(self, domain_name, subnet, ipv6, port):
message = dns.message.make_query(domain_name, 'A') message = dns.message.make_query(domain_name, 'A')
client_subnet_option = dns.edns.ECSOption(subnet) client_subnet_option = dns.edns.ECSOption(subnet)
message.use_edns(options=[client_subnet_option]) message.use_edns(options=[client_subnet_option])
answer = dns.query.udp(message, self._ipv6_address, port=DNS_PORT) answer = dns.query.udp(message, ipv6, port=port)
return answer.get_rrset( return answer.get_rrset(
dns.message.ANSWER, dns.message.ANSWER,
dns.name.from_text(domain_name), dns.name.from_text(domain_name),
...@@ -211,8 +211,9 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase): ...@@ -211,8 +211,9 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase):
dns.rdatatype.CNAME dns.rdatatype.CNAME
).to_text().split()[-1] ).to_text().split()[-1]
def _test_dns_resolver(self): def _test_dns_resolver(self, dns_quantity):
slave_parameter_dict_dict = self.getSlaveParameterDictDict() slave_parameter_dict_dict = self.getSlaveParameterDictDict()
connection_dict = self.computer_partition.getConnectionParameterDict()
subnet_dict = { subnet_dict = {
'africa': AFRICAN_SUBNET, 'africa': AFRICAN_SUBNET,
'china-telecom': CHINA_TELECOM_SUBNET, 'china-telecom': CHINA_TELECOM_SUBNET,
...@@ -248,13 +249,19 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase): ...@@ -248,13 +249,19 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase):
slave_parameter_dict['record'], slave_parameter_dict['applicable-zone'] slave_parameter_dict['record'], slave_parameter_dict['applicable-zone']
) )
for region in subnet_dict: for region in subnet_dict:
for replicate_nb in range(1, dns_quantity + 1):
ns_id = 'ns%s' % replicate_nb
self.assertEqual( self.assertEqual(
slave_parameter_dict.get( slave_parameter_dict.get(
region, region,
'%s.%s.' % ( '%s.%s.' % (
default_rr_dict[region], slave_parameter_dict['origin']) default_rr_dict[region], slave_parameter_dict['origin'])
), ),
self.dns_query(domain_name, subnet_dict[region]) self.dns_query(
domain_name,
subnet_dict[region],
connection_dict[ns_id + '-ipv6'],
int(connection_dict[ns_id + '-port']))
) )
def _test_slaves(self, dns_quantity=1): def _test_slaves(self, dns_quantity=1):
...@@ -262,7 +269,7 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase): ...@@ -262,7 +269,7 @@ class PowerDNSSlaveTestCase(PowerDNSTestCase):
dns_quantity=dns_quantity, dns_quantity=dns_quantity,
slave_amount=len(self.getSlaveParameterDictDict()) slave_amount=len(self.getSlaveParameterDictDict())
) )
self._test_dns_resolver() self._test_dns_resolver(dns_quantity)
class TestSlaveRequest(PowerDNSSlaveTestCase): class TestSlaveRequest(PowerDNSSlaveTestCase):
...@@ -421,7 +428,7 @@ class TestSlaveRequestDomains(TestSlaveRequest): ...@@ -421,7 +428,7 @@ class TestSlaveRequestDomains(TestSlaveRequest):
} }
# Because all powerdns instances run under the same ip address during tests, # Because all powerdns instances run under the same ipv4 address during tests,
# there is a port conflict between these instances # there is a port conflict between these instances
@skip @skip
class TestMultipleInstances(TestSlaveRequestDomains): class TestMultipleInstances(TestSlaveRequestDomains):
......
...@@ -85,6 +85,7 @@ KEDIFA_PORT = '15080' ...@@ -85,6 +85,7 @@ KEDIFA_PORT = '15080'
# IP to originate requests from # IP to originate requests from
# has to be not partition one # has to be not partition one
SOURCE_IP = '127.0.0.1' SOURCE_IP = '127.0.0.1'
SOURCE_IPV6 = '::1'
# IP on which test run, in order to mimic HTTP[s] access # IP on which test run, in order to mimic HTTP[s] access
TEST_IP = os.environ['SLAPOS_TEST_IPV4'] TEST_IP = os.environ['SLAPOS_TEST_IPV4']
...@@ -321,6 +322,10 @@ class TestDataMixin(object): ...@@ -321,6 +322,10 @@ class TestDataMixin(object):
for replacement in sorted(data_replacement_dict.keys()): for replacement in sorted(data_replacement_dict.keys()):
value = data_replacement_dict[replacement] value = data_replacement_dict[replacement]
if isinstance(value, list):
for v in value:
runtime_data = runtime_data.replace(v, replacement)
else:
runtime_data = runtime_data.replace(value, replacement) runtime_data = runtime_data.replace(value, replacement)
longMessage = self.longMessage longMessage = self.longMessage
...@@ -439,12 +444,15 @@ class TestDataMixin(object): ...@@ -439,12 +444,15 @@ class TestDataMixin(object):
# sent like this to the real master # sent like this to the real master
parameter_dict['_'] = json.loads(parameter_dict['_']) parameter_dict['_'] = json.loads(parameter_dict['_'])
parameter_dict['timestamp'] = '@@TIMESTAMP@@' parameter_dict['timestamp'] = '@@TIMESTAMP@@'
# remove ip_list since it's unused and the order may be unstable
parameter_dict.pop('ip_list', None)
cluster_request_parameter_list.append(parameter_dict) cluster_request_parameter_list.append(parameter_dict)
# XXX: Dirty decode/encode/decode...? # XXX: Dirty decode/encode/decode...?
data_replacement_dict = { data_replacement_dict = {
'@@_ipv4_address@@': self._ipv4_address, '@@_ipv4_address@@': self._ipv4_address,
'@@_ipv6_address@@': self._ipv6_address, '@@_ipv6_address@@': [
self.master_ipv6, self.kedifa_ipv6, self.caddy_frontend1_ipv6],
'@@_server_http_port@@': str(self._server_http_port), '@@_server_http_port@@': str(self._server_http_port),
'@@_server_https_auth_port@@': str(self._server_https_auth_port), '@@_server_https_auth_port@@': str(self._server_https_auth_port),
'@@_server_https_port@@': str(self._server_https_port), '@@_server_https_port@@': str(self._server_https_port),
...@@ -736,7 +744,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -736,7 +744,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
cls.backend_url = 'http://%s:%s/' % server.server_address cls.backend_url = 'http://%s:%s/' % server.server_address
server_process = multiprocessing.Process( server_process = multiprocessing.Process(
target=server.serve_forever, name='HTTPServer') target=server.serve_forever, name='HTTPServer', daemon=True)
server_process.start() server_process.start()
# from now on, socket is used by server subprocess, we can close it # from now on, socket is used by server subprocess, we can close it
server.socket.close() server.socket.close()
...@@ -744,7 +752,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -744,7 +752,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
cls.backend_https_url = 'https://%s:%s/' % server_https.server_address cls.backend_https_url = 'https://%s:%s/' % server_https.server_address
server_https_process = multiprocessing.Process( server_https_process = multiprocessing.Process(
target=server_https.serve_forever, name='HTTPSServer') target=server_https.serve_forever, name='HTTPSServer', daemon=True)
server_https_process.start() server_https_process.start()
server_https.socket.close() server_https.socket.close()
cls.logger.debug('Started process %s' % (server_https_process,)) cls.logger.debug('Started process %s' % (server_https_process,))
...@@ -756,7 +764,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -756,7 +764,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
(cls._ipv4_address, cls._server_netloc_a_http_port), (cls._ipv4_address, cls._server_netloc_a_http_port),
NetlocHandler) NetlocHandler)
netloc_a_http_process = multiprocessing.Process( netloc_a_http_process = multiprocessing.Process(
target=netloc_a_http.serve_forever, name='netloc-a-http') target=netloc_a_http.serve_forever, name='netloc-a-http', daemon=True)
netloc_a_http_process.start() netloc_a_http_process.start()
netloc_a_http.socket.close() netloc_a_http.socket.close()
...@@ -764,7 +772,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -764,7 +772,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
(cls._ipv4_address, cls._server_netloc_b_http_port), (cls._ipv4_address, cls._server_netloc_b_http_port),
NetlocHandler) NetlocHandler)
netloc_b_http_process = multiprocessing.Process( netloc_b_http_process = multiprocessing.Process(
target=netloc_b_http.serve_forever, name='netloc-b-http') target=netloc_b_http.serve_forever, name='netloc-b-http', daemon=True)
netloc_b_http_process.start() netloc_b_http_process.start()
netloc_b_http.socket.close() netloc_b_http.socket.close()
...@@ -821,7 +829,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -821,7 +829,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
% server_https_auth.server_address % server_https_auth.server_address
self.server_https_auth_process = multiprocessing.Process( self.server_https_auth_process = multiprocessing.Process(
target=server_https_auth.serve_forever, name='HTTPSServerAuth') target=server_https_auth.serve_forever, name='HTTPSServerAuth', daemon=True)
self.server_https_auth_process.start() self.server_https_auth_process.start()
server_https_auth.socket.close() server_https_auth.socket.close()
self.logger.debug('Started process %s' % (self.server_https_auth_process,)) self.logger.debug('Started process %s' % (self.server_https_auth_process,))
...@@ -1063,7 +1071,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -1063,7 +1071,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
generate_auth_url = parameter_dict.pop('%skey-generate-auth-url' % ( generate_auth_url = parameter_dict.pop('%skey-generate-auth-url' % (
prefix,)) prefix,))
upload_url = parameter_dict.pop('%skey-upload-url' % (prefix,)) upload_url = parameter_dict.pop('%skey-upload-url' % (prefix,))
kedifa_ipv6_base = 'https://[%s]:%s' % (self._ipv6_address, KEDIFA_PORT) kedifa_ipv6_base = 'https://[%s]:%s' % (self.kedifa_ipv6, KEDIFA_PORT)
base = '^' + kedifa_ipv6_base.replace( base = '^' + kedifa_ipv6_base.replace(
'[', r'\[').replace(']', r'\]') + '/.{32}' '[', r'\[').replace(']', r'\]') + '/.{32}'
self.assertRegex( self.assertRegex(
...@@ -1078,7 +1086,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -1078,7 +1086,7 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
kedifa_caucase_url = parameter_dict.pop('kedifa-caucase-url') kedifa_caucase_url = parameter_dict.pop('kedifa-caucase-url')
self.assertEqual( self.assertEqual(
kedifa_caucase_url, kedifa_caucase_url,
'http://[%s]:%s' % (self._ipv6_address, CAUCASE_PORT), 'http://[%s]:%s' % (self.kedifa_ipv6, CAUCASE_PORT),
) )
return generate_auth_url, upload_url return generate_auth_url, upload_url
...@@ -1244,6 +1252,13 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -1244,6 +1252,13 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
cls.setUp = lambda self: self.fail('Setup Class failed.') cls.setUp = lambda self: self.fail('Setup Class failed.')
raise raise
# Lookup partitions IPv6
cls.master_ipv6 = cls.computer_partition_ipv6_address
kedifa_partition = cls.getPartitionId('kedifa')
cls.kedifa_ipv6 = cls.getPartitionIPv6(kedifa_partition)
caddy_frontend1_partition = cls.getPartitionId('caddy-frontend-1')
cls.caddy_frontend1_ipv6 = cls.getPartitionIPv6(caddy_frontend1_partition)
class SlaveHttpFrontendTestCase(HttpFrontendTestCase): class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
def _get_backend_haproxy_configuration(self): def _get_backend_haproxy_configuration(self):
...@@ -1380,7 +1395,7 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase): ...@@ -1380,7 +1395,7 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
'url': 'http://%s.example.com' % (hostname, ), 'url': 'http://%s.example.com' % (hostname, ),
'site_url': 'http://%s.example.com' % (hostname, ), 'site_url': 'http://%s.example.com' % (hostname, ),
'secure_access': 'https://%s.example.com' % (hostname, ), 'secure_access': 'https://%s.example.com' % (hostname, ),
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
}) })
self.assertEqual( self.assertEqual(
expected_parameter_dict, expected_parameter_dict,
...@@ -1429,8 +1444,8 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin): ...@@ -1429,8 +1444,8 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
self.assertEqual( self.assertEqual(
{ {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '0', 'accepted-slave-amount': '0',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -1461,8 +1476,8 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin): ...@@ -1461,8 +1476,8 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin):
self.assertNodeInformationWithPop(parameter_dict) self.assertNodeInformationWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'None', 'domain': 'None',
'accepted-slave-amount': '0', 'accepted-slave-amount': '0',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -1503,8 +1518,11 @@ class TestMasterAIKCDisabledAIBCCDisabledRequest( ...@@ -1503,8 +1518,11 @@ class TestMasterAIKCDisabledAIBCCDisabledRequest(
_, kedifa_key_pem, _, kedifa_csr_pem = createCSR('Kedifa User') _, kedifa_key_pem, _, kedifa_csr_pem = createCSR('Kedifa User')
_, backend_client_key_pem, _, backend_client_csr_pem = createCSR( _, backend_client_key_pem, _, backend_client_csr_pem = createCSR(
'Backend Client User') 'Backend Client User')
parameter_dict = cls.requestDefaultInstance( cls.computer_partition = cls.requestDefaultInstance()
).getConnectionParameterDict() # Compute IPv6 here since super()._setUpClass failed
cls.computer_partition_ipv6_address = cls.getPartitionIPv6(
cls.computer_partition.getId())
parameter_dict = cls.computer_partition.getConnectionParameterDict()
cls._fetchKedifaCaucaseCaCertificateFile(parameter_dict) cls._fetchKedifaCaucaseCaCertificateFile(parameter_dict)
cls._fetchBackendClientCaCertificateFile(parameter_dict) cls._fetchBackendClientCaCertificateFile(parameter_dict)
with open(cls.kedifa_caucase_ca_certificate_file) as fh: with open(cls.kedifa_caucase_ca_certificate_file) as fh:
...@@ -1577,8 +1595,8 @@ class TestMasterAIKCDisabledAIBCCDisabledRequest( ...@@ -1577,8 +1595,8 @@ class TestMasterAIKCDisabledAIBCCDisabledRequest(
self.assertNodeInformationWithPop(parameter_dict) self.assertNodeInformationWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'None', 'domain': 'None',
'accepted-slave-amount': '0', 'accepted-slave-amount': '0',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -1937,34 +1955,36 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -1937,34 +1955,36 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
monitor_setup_url_key = 'monitor-setup-url' monitor_setup_url_key = 'monitor-setup-url'
def test_monitor_setup(self): def test_monitor_setup(self):
IP = self._ipv6_address MASTER_IP = self.master_ipv6
KEDIFA_IP = self.kedifa_ipv6
CADDY_IP = self.caddy_frontend1_ipv6
self.monitor_configuration_list = [ self.monitor_configuration_list = [
{ {
'htmlUrl': 'https://[%s]:8401/public/feed' % (IP,), 'htmlUrl': 'https://[%s]:8401/public/feed' % (MASTER_IP,),
'text': 'testing partition 0', 'text': 'testing partition 0',
'title': 'testing partition 0', 'title': 'testing partition 0',
'type': 'rss', 'type': 'rss',
'url': 'https://[%s]:8401/share/private/' % (IP,), 'url': 'https://[%s]:8401/share/private/' % (MASTER_IP,),
'version': 'RSS', 'version': 'RSS',
'xmlUrl': 'https://[%s]:8401/public/feed' % (IP,), 'xmlUrl': 'https://[%s]:8401/public/feed' % (MASTER_IP,),
}, },
{ {
'htmlUrl': 'https://[%s]:8402/public/feed' % (IP,), 'htmlUrl': 'https://[%s]:8402/public/feed' % (KEDIFA_IP,),
'text': 'kedifa', 'text': 'kedifa',
'title': 'kedifa', 'title': 'kedifa',
'type': 'rss', 'type': 'rss',
'url': 'https://[%s]:8402/share/private/' % (IP,), 'url': 'https://[%s]:8402/share/private/' % (KEDIFA_IP,),
'version': 'RSS', 'version': 'RSS',
'xmlUrl': 'https://[%s]:8402/public/feed' % (IP,), 'xmlUrl': 'https://[%s]:8402/public/feed' % (KEDIFA_IP,),
}, },
{ {
'htmlUrl': 'https://[%s]:8411/public/feed' % (IP,), 'htmlUrl': 'https://[%s]:8411/public/feed' % (CADDY_IP,),
'text': 'caddy-frontend-1', 'text': 'caddy-frontend-1',
'title': 'caddy-frontend-1', 'title': 'caddy-frontend-1',
'type': 'rss', 'type': 'rss',
'url': 'https://[%s]:8411/share/private/' % (IP,), 'url': 'https://[%s]:8411/share/private/' % (CADDY_IP,),
'version': 'RSS', 'version': 'RSS',
'xmlUrl': 'https://[%s]:8411/public/feed' % (IP,), 'xmlUrl': 'https://[%s]:8411/public/feed' % (CADDY_IP,),
}, },
] ]
connection_parameter_dict = self\ connection_parameter_dict = self\
...@@ -2098,8 +2118,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2098,8 +2118,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertNodeInformationWithPop(parameter_dict) self.assertNodeInformationWithPop(parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '62', 'accepted-slave-amount': '62',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -2429,14 +2449,14 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2429,14 +2449,14 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
# check out access via IPv6 # check out access via IPv6
out_ipv6, err_ipv6 = self._curl( out_ipv6, err_ipv6 = self._curl(
parameter_dict['domain'], self._ipv6_address, HTTPS_PORT) parameter_dict['domain'], self.caddy_frontend1_ipv6, HTTPS_PORT,
source_ip=SOURCE_IPV6)
try: try:
j = json.loads(out_ipv6.decode()) j = json.loads(out_ipv6.decode())
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (out_ipv6.decode(),)) raise ValueError('JSON decode problem in:\n%s' % (out_ipv6.decode(),))
self.assertEqual( self.assertEqual(
self._ipv6_address, SOURCE_IPV6,
j['Incoming Headers']['x-forwarded-for'] j['Incoming Headers']['x-forwarded-for']
) )
...@@ -4618,7 +4638,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4618,7 +4638,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result.headers['Location'] result.headers['Location']
) )
def _curl(self, domain, ip, port, cookie=None): def _curl(self, domain, ip, port, cookie=None, source_ip=None):
replacement_dict = dict( replacement_dict = dict(
domain=domain, ip=ip, port=port) domain=domain, ip=ip, port=port)
curl_command = [ curl_command = [
...@@ -4628,6 +4648,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4628,6 +4648,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
] ]
if cookie is not None: if cookie is not None:
curl_command.extend(['--cookie', cookie]) curl_command.extend(['--cookie', cookie])
if source_ip is not None:
curl_command.extend(['--interface', source_ip])
curl_command.extend([ curl_command.extend([
'https://%(domain)s:%(port)s/' % replacement_dict]) 'https://%(domain)s:%(port)s/' % replacement_dict])
prc = subprocess.Popen( prc = subprocess.Popen(
...@@ -4797,7 +4819,47 @@ class TestEnableHttp2ByDefaultFalseSlave(TestSlave): ...@@ -4797,7 +4819,47 @@ class TestEnableHttp2ByDefaultFalseSlave(TestSlave):
test_enable_http3_false_http_version = '1' test_enable_http3_false_http_version = '1'
class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
class ReplicateSlaveMixin(object):
def frontends1And2HaveDifferentIPv6(self):
_, *prefixlen = self._ipv6_address.split('/')
return bool(prefixlen and int(prefixlen[0]) < 127)
def requestSecondFrontend(self, final_state='stopped'):
ipv6_collision = not self.frontends1And2HaveDifferentIPv6()
# now instantiate 2nd partition in started state
# and due to port collision, stop the first one...
self.instance_parameter_dict.update({
'-frontend-quantity': 2,
'-sla-2-computer_guid': self.slap._computer_id,
'-frontend-1-state': 'stopped',
'-frontend-2-state': 'started',
})
self.requestDefaultInstance()
self.requestSlaves()
try:
self.slap.waitForInstance(self.instance_max_retry)
except Exception:
if ipv6_collision:
raise
# for now, accept failing promise due to stopped frontend
finally:
# ...and be nice, put back the first one online
self.instance_parameter_dict.update({
'-frontend-1-state': 'started',
'-frontend-2-state': final_state,
})
self.requestDefaultInstance()
for _ in range(3):
try:
self.slap.waitForInstance(self.instance_max_retry)
except Exception:
if ipv6_collision:
raise
# for now, accept failing promise due to stopped frontend
class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin, ReplicateSlaveMixin):
instance_parameter_dict = { instance_parameter_dict = {
'domain': 'example.com', 'domain': 'example.com',
'port': HTTPS_PORT, 'port': HTTPS_PORT,
...@@ -4819,27 +4881,12 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4819,27 +4881,12 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
}, },
} }
def frontends1And2HaveDifferentIPv6(self):
_, *prefixlen = self._ipv6_address.split('/')
return bool(prefixlen and int(prefixlen[0]) < 127)
def test(self): def test(self):
# now instantiate 2nd partition in started state self.requestSecondFrontend()
# and due to port collision, stop the first one...
self.instance_parameter_dict.update({
'-frontend-quantity': 2,
'-sla-2-computer_guid': self.slap._computer_id,
'-frontend-1-state': 'stopped',
'-frontend-2-state': 'started',
})
self.requestDefaultInstance()
self.requestSlaves()
self.slap.waitForInstance(self.instance_max_retry)
# ...and be nice, put back the first one online
self.instance_parameter_dict.update({
'-frontend-1-state': 'started',
'-frontend-2-state': 'stopped',
})
self.requestDefaultInstance()
self.slap.waitForInstance(self.instance_max_retry)
self.slap.waitForInstance(self.instance_max_retry)
self.slap.waitForInstance(self.instance_max_retry)
self.updateSlaveConnectionParameterDictDict() self.updateSlaveConnectionParameterDictDict()
# the real assertions follow... # the real assertions follow...
...@@ -4871,7 +4918,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4871,7 +4918,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
'url': 'http://replicate.example.com', 'url': 'http://replicate.example.com',
'site_url': 'http://replicate.example.com', 'site_url': 'http://replicate.example.com',
'secure_access': 'https://replicate.example.com', 'secure_access': 'https://replicate.example.com',
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
}, },
parameter_dict parameter_dict
) )
...@@ -4906,7 +4953,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4906,7 +4953,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
class TestReplicateSlaveOtherDestroyed(SlaveHttpFrontendTestCase): class TestReplicateSlaveOtherDestroyed(SlaveHttpFrontendTestCase, ReplicateSlaveMixin):
instance_parameter_dict = { instance_parameter_dict = {
'domain': 'example.com', 'domain': 'example.com',
'port': HTTPS_PORT, 'port': HTTPS_PORT,
...@@ -4929,27 +4976,7 @@ class TestReplicateSlaveOtherDestroyed(SlaveHttpFrontendTestCase): ...@@ -4929,27 +4976,7 @@ class TestReplicateSlaveOtherDestroyed(SlaveHttpFrontendTestCase):
} }
def test_extra_slave_instance_list_not_present_destroyed_request(self): def test_extra_slave_instance_list_not_present_destroyed_request(self):
# now instantiate 2nd partition in started state self.requestSecondFrontend(final_state='destroyed')
# and due to port collision, stop the first one
self.instance_parameter_dict.update({
'-frontend-quantity': 2,
'-sla-2-computer_guid': self.slap._computer_id,
'-frontend-1-state': 'stopped',
'-frontend-2-state': 'started',
})
self.requestDefaultInstance()
self.slap.waitForInstance(self.instance_max_retry)
# now start back first instance, and destroy 2nd one
self.instance_parameter_dict.update({
'-frontend-1-state': 'started',
'-frontend-2-state': 'destroyed',
})
self.requestDefaultInstance()
self.slap.waitForInstance(self.instance_max_retry)
self.slap.waitForInstance(self.instance_max_retry)
self.slap.waitForInstance(self.instance_max_retry)
buildout_file = os.path.join( buildout_file = os.path.join(
self.getMasterPartitionPath(), 'instance-master.cfg') self.getMasterPartitionPath(), 'instance-master.cfg')
...@@ -5331,8 +5358,8 @@ class TestSlaveSlapOSMasterCertificateCompatibility( ...@@ -5331,8 +5358,8 @@ class TestSlaveSlapOSMasterCertificateCompatibility(
self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict) self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '12', 'accepted-slave-amount': '12',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -5838,8 +5865,8 @@ class TestSlaveSlapOSMasterCertificateCompatibilityUpdate( ...@@ -5838,8 +5865,8 @@ class TestSlaveSlapOSMasterCertificateCompatibilityUpdate(
self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict) self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '1', 'accepted-slave-amount': '1',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -5930,8 +5957,8 @@ class TestSlaveCiphers(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -5930,8 +5957,8 @@ class TestSlaveCiphers(SlaveHttpFrontendTestCase, TestDataMixin):
self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict) self.assertRejectedSlavePromiseEmptyWithPop(parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '2', 'accepted-slave-amount': '2',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
...@@ -6192,8 +6219,8 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase): ...@@ -6192,8 +6219,8 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
self.assertRejectedSlavePromiseWithPop(parameter_dict) self.assertRejectedSlavePromiseWithPop(parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
'monitor-base-url': 'https://[%s]:8401' % self._ipv6_address, 'monitor-base-url': 'https://[%s]:8401' % self.master_ipv6,
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
'domain': 'example.com', 'domain': 'example.com',
'accepted-slave-amount': '3', 'accepted-slave-amount': '3',
'rejected-slave-amount': '28', 'rejected-slave-amount': '28',
...@@ -6428,7 +6455,7 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase): ...@@ -6428,7 +6455,7 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'url': 'http://defaultpathunsafe.example.com', 'url': 'http://defaultpathunsafe.example.com',
'site_url': 'http://defaultpathunsafe.example.com', 'site_url': 'http://defaultpathunsafe.example.com',
'secure_access': 'https://defaultpathunsafe.example.com', 'secure_access': 'https://defaultpathunsafe.example.com',
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self.master_ipv6,
}, },
parameter_dict parameter_dict
) )
...@@ -6722,8 +6749,8 @@ class TestPassedRequestParameter(HttpFrontendTestCase): ...@@ -6722,8 +6749,8 @@ class TestPassedRequestParameter(HttpFrontendTestCase):
'kedifa'].pop('monitor-password') 'kedifa'].pop('monitor-password')
) )
backend_client_caucase_url = 'http://[%s]:8990' % (self._ipv6_address,) backend_client_caucase_url = 'http://[%s]:8990' % (self.master_ipv6,)
kedifa_caucase_url = 'http://[%s]:15090' % (self._ipv6_address,) kedifa_caucase_url = 'http://[%s]:15090' % (self.kedifa_ipv6,)
expected_partition_parameter_dict_dict = { expected_partition_parameter_dict_dict = {
'caddy-frontend-1': { 'caddy-frontend-1': {
'X-software_release_url': base_software_url, 'X-software_release_url': base_software_url,
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -80,16 +70,6 @@ ...@@ -80,16 +70,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -119,16 +99,6 @@ ...@@ -119,16 +99,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -5,16 +5,6 @@ ...@@ -5,16 +5,6 @@
"enable-http2-by-default": "false", "enable-http2-by-default": "false",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -844,16 +834,6 @@ ...@@ -844,16 +834,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -885,16 +865,6 @@ ...@@ -885,16 +865,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -5,16 +5,6 @@ ...@@ -5,16 +5,6 @@
"caucase_port": "15090", "caucase_port": "15090",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -39,16 +29,6 @@ ...@@ -39,16 +29,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -77,16 +57,6 @@ ...@@ -77,16 +57,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -3,16 +3,6 @@ ...@@ -3,16 +3,6 @@
"caucase_port": "15090", "caucase_port": "15090",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -37,16 +27,6 @@ ...@@ -37,16 +27,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -75,16 +55,6 @@ ...@@ -75,16 +55,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -38,16 +28,6 @@ ...@@ -38,16 +28,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -77,16 +57,6 @@ ...@@ -77,16 +57,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -52,16 +42,6 @@ ...@@ -52,16 +42,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -91,16 +71,6 @@ ...@@ -91,16 +71,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -52,16 +42,6 @@ ...@@ -52,16 +42,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -91,16 +71,6 @@ ...@@ -91,16 +71,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -8,16 +8,6 @@ ...@@ -8,16 +8,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -56,16 +46,6 @@ ...@@ -56,16 +46,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -95,16 +75,6 @@ ...@@ -95,16 +75,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
...@@ -134,16 +104,6 @@ ...@@ -134,16 +104,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-2", "instance_title": "caddy-frontend-2",
"ip_list": [
[
"T-3",
"@@_ipv4_address@@"
],
[
"T-3",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-3", "slap_computer_partition_id": "T-3",
......
...@@ -38,23 +38,3 @@ T-2:slave-instrospection-nginx-{hash-generic}-on-watch RUNNING ...@@ -38,23 +38,3 @@ T-2:slave-instrospection-nginx-{hash-generic}-on-watch RUNNING
T-2:slave-introspection-safe-graceful EXITED T-2:slave-introspection-safe-graceful EXITED
T-2:trafficserver-{hash-generic}-on-watch RUNNING T-2:trafficserver-{hash-generic}-on-watch RUNNING
T-2:trafficserver-reload EXITED T-2:trafficserver-reload EXITED
T-3:backend-client-login-certificate-caucase-updater-on-watch STOPPED
T-3:backend-haproxy-{hash-generic}-on-watch STOPPED
T-3:backend-haproxy-rsyslogd-{hash-generic}-on-watch STOPPED
T-3:backend-haproxy-safe-graceful EXITED
T-3:bootstrap-monitor EXITED
T-3:certificate_authority-{hash-generic}-on-watch STOPPED
T-3:crond-{hash-generic}-on-watch STOPPED
T-3:expose-csr-{hash-generic}-on-watch STOPPED
T-3:frontend-haproxy-{hash-generic}-on-watch STOPPED
T-3:frontend-haproxy-rsyslogd-{hash-generic}-on-watch STOPPED
T-3:frontend-haproxy-safe-graceful EXITED
T-3:kedifa-login-certificate-caucase-updater-on-watch STOPPED
T-3:kedifa-updater-{hash-generic}-on-watch STOPPED
T-3:logrotate-setup-validate EXITED
T-3:monitor-httpd-{hash-generic}-on-watch STOPPED
T-3:monitor-httpd-graceful EXITED
T-3:slave-instrospection-nginx-{hash-generic}-on-watch STOPPED
T-3:slave-introspection-safe-graceful EXITED
T-3:trafficserver-{hash-generic}-on-watch STOPPED
T-3:trafficserver-reload EXITED
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -843,16 +833,6 @@ ...@@ -843,16 +833,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -883,16 +863,6 @@ ...@@ -883,16 +863,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -5,16 +5,6 @@ ...@@ -5,16 +5,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -67,16 +57,6 @@ ...@@ -67,16 +57,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -107,16 +87,6 @@ ...@@ -107,16 +87,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -257,16 +247,6 @@ ...@@ -257,16 +247,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -297,16 +277,6 @@ ...@@ -297,16 +277,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -65,16 +55,6 @@ ...@@ -65,16 +55,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -105,16 +85,6 @@ ...@@ -105,16 +85,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
"full_address_list": [], "full_address_list": [],
"http3-port": "11443", "http3-port": "11443",
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -845,16 +835,6 @@ ...@@ -845,16 +835,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -885,16 +865,6 @@ ...@@ -885,16 +865,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -214,16 +204,6 @@ ...@@ -214,16 +204,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -255,16 +235,6 @@ ...@@ -255,16 +235,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -54,16 +44,6 @@ ...@@ -54,16 +44,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -95,16 +75,6 @@ ...@@ -95,16 +75,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
"domain": "example.com", "domain": "example.com",
"full_address_list": [], "full_address_list": [],
"instance_title": "testing partition 0", "instance_title": "testing partition 0",
"ip_list": [
[
"T-0",
"@@_ipv4_address@@"
],
[
"T-0",
"@@_ipv6_address@@"
]
],
"kedifa_port": "15080", "kedifa_port": "15080",
"plain_http_port": "11080", "plain_http_port": "11080",
"port": "11443", "port": "11443",
...@@ -54,16 +44,6 @@ ...@@ -54,16 +44,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "kedifa", "instance_title": "kedifa",
"ip_list": [
[
"T-1",
"@@_ipv4_address@@"
],
[
"T-1",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-1", "slap_computer_partition_id": "T-1",
...@@ -95,16 +75,6 @@ ...@@ -95,16 +75,6 @@
}, },
"full_address_list": [], "full_address_list": [],
"instance_title": "caddy-frontend-1", "instance_title": "caddy-frontend-1",
"ip_list": [
[
"T-2",
"@@_ipv4_address@@"
],
[
"T-2",
"@@_ipv6_address@@"
]
],
"root_instance_title": "testing partition 0", "root_instance_title": "testing partition 0",
"slap_computer_id": "local", "slap_computer_id": "local",
"slap_computer_partition_id": "T-2", "slap_computer_partition_id": "T-2",
......
...@@ -125,7 +125,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin): ...@@ -125,7 +125,7 @@ class TestJupyter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
param_dict = self.getRootPartitionConnectionParameterDict() param_dict = self.getRootPartitionConnectionParameterDict()
self.assertEqual( self.assertEqual(
f'https://[{self._ipv6_address}]:8888/tree', f'https://[{self.getPartitionIPv6(self.getPartitionId("jupyter"))}]:8888/tree',
param_dict['jupyter-url'] param_dict['jupyter-url']
) )
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = ed0f91f39d5eda903938aa527625f40d md5sum = f10fbca22d1d30dd7a4f36e1cd521b97
...@@ -95,6 +95,11 @@ inline = ...@@ -95,6 +95,11 @@ inline =
echo "To work on a test, execute:" echo "To work on a test, execute:"
echo " SLAPOS_TEST_DEBUG=1 {{ interpreter }} -m unittest discover -v" echo " SLAPOS_TEST_DEBUG=1 {{ interpreter }} -m unittest discover -v"
echo "from a folder containing software release test." echo "from a folder containing software release test."
echo "Tip: you may want to also add"
echo " SLAPOS_TEST_SKIP_SOFTWARE_REBUILD=1"
echo " SLAPOS_TEST_SKIP_SOFTWARE_CHECK=1"
echo " SLAPOS_TEST_LOG_DIRECTORY=<some-empty-directory>"
echo "See https://lab.nexedi.com/nexedi/slapos/tree/master/software/slapos-sr-testing"
echo echo
[publish] [publish]
......
...@@ -34,6 +34,7 @@ import re ...@@ -34,6 +34,7 @@ import re
import subprocess import subprocess
import sqlite3 import sqlite3
import time import time
import unittest
import netaddr import netaddr
import pexpect import pexpect
...@@ -248,6 +249,12 @@ class TestTheia(TheiaTestCase): ...@@ -248,6 +249,12 @@ class TestTheia(TheiaTestCase):
proxy_path = self.getPath('srv', 'runner', 'var', 'proxy.db') proxy_path = self.getPath('srv', 'runner', 'var', 'proxy.db')
query = "SELECT partition_reference, address FROM partition_network%s" % DB_VERSION query = "SELECT partition_reference, address FROM partition_network%s" % DB_VERSION
ipv6, *prefixlen = self._ipv6_address.split('/')
if not prefixlen:
raise unittest.SkipTest('No IPv6 range')
elif int(prefixlen[0]) >= 123:
raise unittest.SkipTest('IPv6 range too small: %s' % self._ipv6_address)
with sqlite3.connect(proxy_path) as db: with sqlite3.connect(proxy_path) as db:
rows = db.execute(query).fetchall() rows = db.execute(query).fetchall()
partitions = set(p for p, _ in rows) partitions = set(p for p, _ in rows)
......
...@@ -184,6 +184,7 @@ class ExportAndImportMixin(object): ...@@ -184,6 +184,7 @@ class ExportAndImportMixin(object):
def assertPromiseSucess(self): def assertPromiseSucess(self):
# Force promises to recompute regardless of periodicity # Force promises to recompute regardless of periodicity
old_value = self.slap._force_slapos_node_instance_all
self.slap._force_slapos_node_instance_all = True self.slap._force_slapos_node_instance_all = True
try: try:
self.slap.waitForInstance(error_lines=0) self.slap.waitForInstance(error_lines=0)
...@@ -193,8 +194,8 @@ class ExportAndImportMixin(object): ...@@ -193,8 +194,8 @@ class ExportAndImportMixin(object):
self.assertNotIn('ERROR export script', s) self.assertNotIn('ERROR export script', s)
self.assertNotIn("Promise 'resiliency-import-promise.py' failed", s) self.assertNotIn("Promise 'resiliency-import-promise.py' failed", s)
self.assertNotIn('ERROR import script', s) self.assertNotIn('ERROR import script', s)
else: finally:
pass self.slap._force_slapos_node_instance_all = old_value
def _doExport(self): def _doExport(self):
# Compute last modification of the export exitcode file # Compute last modification of the export exitcode file
...@@ -247,6 +248,7 @@ class TestTheiaExportAndImportFailures(ExportAndImportMixin, ResilientTheiaTestC ...@@ -247,6 +248,7 @@ class TestTheiaExportAndImportFailures(ExportAndImportMixin, ResilientTheiaTestC
def assertPromiseFailure(self, *msg): def assertPromiseFailure(self, *msg):
# Force promises to recompute regardless of periodicity # Force promises to recompute regardless of periodicity
old_value = self.slap._force_slapos_node_instance_all
self.slap._force_slapos_node_instance_all = True self.slap._force_slapos_node_instance_all = True
try: try:
self.slap.waitForInstance(error_lines=0) self.slap.waitForInstance(error_lines=0)
...@@ -256,6 +258,8 @@ class TestTheiaExportAndImportFailures(ExportAndImportMixin, ResilientTheiaTestC ...@@ -256,6 +258,8 @@ class TestTheiaExportAndImportFailures(ExportAndImportMixin, ResilientTheiaTestC
self.assertIn(m, s) self.assertIn(m, s)
else: else:
self.fail('No promise failed') self.fail('No promise failed')
finally:
self.slap._force_slapos_node_instance_all = old_value
def assertScriptFailure(self, func, errorfile, exitfile, *msg): def assertScriptFailure(self, func, errorfile, exitfile, *msg):
self.assertRaises( self.assertRaises(
......
...@@ -74,7 +74,7 @@ md5sum = 3f7b28085ceff321a3cb785db60f7c3e ...@@ -74,7 +74,7 @@ md5sum = 3f7b28085ceff321a3cb785db60f7c3e
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 30a1e738a8211887e75a5e75820e5872 md5sum = 7fd36876df18e5cf62e050c2b30abcc9
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
......
...@@ -281,6 +281,8 @@ software-type = zope ...@@ -281,6 +281,8 @@ software-type = zope
{% set partition_name = 'zope-' ~ custom_name -%} {% set partition_name = 'zope-' ~ custom_name -%}
{% set section_name = 'request-' ~ partition_name -%} {% set section_name = 'request-' ~ partition_name -%}
{% set promise_software_url_section_name = 'promise-software-url' ~ partition_name -%} {% set promise_software_url_section_name = 'promise-software-url' ~ partition_name -%}
{% set check_test_runner_url_section_name = 'check-test-runner-url' ~ partition_name -%}
{% set promise_test_runner_url_section_name = 'promise-test-runner-url' ~ partition_name -%}
{% set zope_family = zope_parameter_dict.get('family', 'default') -%} {% set zope_family = zope_parameter_dict.get('family', 'default') -%}
{% do zope_family_name_list.append(zope_family) %} {% do zope_family_name_list.append(zope_family) %}
{% set backend_path = zope_parameter_dict.get('backend-path', '') % {'site-id': site_id} %} {% set backend_path = zope_parameter_dict.get('backend-path', '') % {'site-id': site_id} %}
...@@ -315,6 +317,25 @@ config-activity-timeout = {{ dumps(current_zope_family_override_dict.get('activi ...@@ -315,6 +317,25 @@ config-activity-timeout = {{ dumps(current_zope_family_override_dict.get('activi
{% if test_runner_enabled -%} {% if test_runner_enabled -%}
config-test-runner-apache-url-list = ${publish-early:{{ zope_family }}-test-runner-url-list} config-test-runner-apache-url-list = ${publish-early:{{ zope_family }}-test-runner-url-list}
[{{ check_test_runner_url_section_name }}]
# Promise to wait for zope partition to receive the expected test-runner URL
recipe = slapos.cookbook:check_parameter
value = {{ '${' ~ section_name ~ ':config-test-runner-apache-url-list}' }}
expected-not-value = not-ready
expected-value =
path = ${directory:bin}/${:_buildout_section_name_}
[{{ promise_test_runner_url_section_name }}]
<= monitor-promise-base
promise = check_command_execute
name = ${:_buildout_section_name_}.py
config-command = {{ '${' ~ check_test_runner_url_section_name ~ ':path}' }}
{% do root_common.section(promise_test_runner_url_section_name) -%}
{% endif -%}
[{{ promise_software_url_section_name }}] [{{ promise_software_url_section_name }}]
# Promise to wait for zope partition to use the expected software URL, # Promise to wait for zope partition to use the expected software URL,
# used on upgrades. # used on upgrades.
...@@ -326,7 +347,6 @@ path = ${directory:bin}/${:_buildout_section_name_} ...@@ -326,7 +347,6 @@ path = ${directory:bin}/${:_buildout_section_name_}
{% do root_common.section(promise_software_url_section_name) -%} {% do root_common.section(promise_software_url_section_name) -%}
{% endif -%}
{% endfor -%} {% endfor -%}
{# if not explicitly configured, connect jupyter to first zope family, which -#} {# if not explicitly configured, connect jupyter to first zope family, which -#}
......
...@@ -297,7 +297,7 @@ simplegeneric = 0.8.1 ...@@ -297,7 +297,7 @@ simplegeneric = 0.8.1
singledispatch = 3.4.0.3 singledispatch = 3.4.0.3
six = 1.16.0 six = 1.16.0
slapos.cookbook = 1.0.329 slapos.cookbook = 1.0.329
slapos.core = 1.10.1 slapos.core = 1.10.2
slapos.extension.shared = 1.0 slapos.extension.shared = 1.0
slapos.libnetworkcache = 0.25 slapos.libnetworkcache = 0.25
slapos.rebootstrap = 4.5 slapos.rebootstrap = 4.5
......
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