Commit ed2165f2 authored by Ivan Tyagov's avatar Ivan Tyagov

Update local frontend slave with backend balanver's IPv6 address if Test Suite...

See merge request !1494
parents f2ceb144 ab77f3e5
...@@ -398,6 +398,11 @@ Require valid-user ...@@ -398,6 +398,11 @@ Require valid-user
self.instance_software_release = configuration.get('instance-software-release') self.instance_software_release = configuration.get('instance-software-release')
self.use_existing_setup = self.instance_name is not None and self.frontend_address is not None self.use_existing_setup = self.instance_name is not None and self.frontend_address is not None
# update from Test Suite's configuration the frontend details
self.frontend_slave_instance_title = configuration.get("frontend-slave-instance-title")
self.frontend_slave_domain = configuration.get("frontend-slave-domain")
self.frontend_slave_software_release_url = configuration.get("frontend-slave-software-release-url")
node_test_suite.edit(configuration_list=configuration_list) node_test_suite.edit(configuration_list=configuration_list)
self.launcher_nodes_computer_guid = test_configuration['launcher_nodes_computer_guid'] self.launcher_nodes_computer_guid = test_configuration['launcher_nodes_computer_guid']
...@@ -514,7 +519,8 @@ Require valid-user ...@@ -514,7 +519,8 @@ Require valid-user
bootstrap_url = suite.getBootstrapScalabilityTestUrl(instance_information, count) bootstrap_url = suite.getBootstrapScalabilityTestUrl(instance_information, count)
metric_url = suite.getScalabilityTestMetricUrl(instance_information) metric_url = suite.getScalabilityTestMetricUrl(instance_information)
site_availability_url = suite.getSiteAvailabilityUrl(instance_information) site_availability_url = suite.getSiteAvailabilityUrl(instance_information)
return instance_url, bootstrap_url, metric_url, site_availability_url balancer_user_v6 = instance_information.get("balancer-user-v6")
return instance_url, bootstrap_url, metric_url, site_availability_url,balancer_user_v6
def bootstrapInstance(self, bootstrap_url): def bootstrapInstance(self, bootstrap_url):
bootstrap_password = error_message = None bootstrap_password = error_message = None
...@@ -613,11 +619,37 @@ Require valid-user ...@@ -613,11 +619,37 @@ Require valid-user
logger.info("Test case for count : %d is in a running state." % count) logger.info("Test case for count : %d is in a running state." % count)
try: try:
instance_url, bootstrap_url, metric_url, site_availability_url = self.getInstanceInformation(suite, count, node_test_suite) instance_url, bootstrap_url, metric_url, site_availability_url, balancer_user_v6 = self.getInstanceInformation(suite, count, node_test_suite)
except Exception as e: except Exception as e:
error_message = "Error getting testsuite information: " + str(e) error_message = "Error getting testsuite information: " + str(e)
break break
# update local front end slave if specified
frontend_slave_instance_title = self.frontend_slave_instance_title
frontend_slave_domain = self.frontend_slave_domain
frontend_slave_software_release_url = self.frontend_slave_software_release_url
if frontend_slave_instance_title is not None and \
frontend_slave_domain is not None and \
frontend_slave_software_release_url is not None:
# set frontend one as API of slapos_commpunicator is doesn't allow it
erp5_software_release = self.slapos_communicator.url
self.slapos_communicator.url = frontend_slave_software_release_url
logger.info("Update frontend slave: %s" %balancer_user_v6)
config = {"custom_domain": frontend_slave_domain,
"url": balancer_user_v6,
"type": "zope",
"https-only": "false"}
request_kw = {"partition_parameter_kw": config}
self.slapos_communicator.requestInstanceStart(frontend_slave_instance_title, \
request_kw, \
shared=True, \
software_type='default')
self.slapos_communicator.url = erp5_software_release
logger.info("Wait frontend until gets updated.")
time.sleep(120)
# use frontend slave rather than previously generate Nexedi CDN one
instance_url = "http://%s/erp5" %frontend_slave_domain
software_bin_directory = self.testnode.config['slapos_binary'].rsplit("slapos", 1)[0] software_bin_directory = self.testnode.config['slapos_binary'].rsplit("slapos", 1)[0]
self.requestUrlScript = software_bin_directory + REQUEST_URL_SCRIPT self.requestUrlScript = software_bin_directory + REQUEST_URL_SCRIPT
......
...@@ -375,7 +375,18 @@ class SlapOSTester(SlapOSMasterCommunicator): ...@@ -375,7 +375,18 @@ class SlapOSTester(SlapOSMasterCommunicator):
user = None user = None
password = None password = None
frontend_url_list = [] frontend_url_list = []
balancer_user_v6 = None
for instance in self.getInstanceUrlList(): for instance in self.getInstanceUrlList():
# get balancer's backend Ipv6 address
if "balancer" in instance["title"]:
try:
to_json = json.loads(instance["getConnectionXmlAsDict"]["_"])
balancer_user_v6 = to_json.get("user-v6")
except Exception as e:
logger.info("balancer ipv6 url not generated yet for instance: " + instance["title"])
pass
# get generated by Nexedi's CDN frontend address
if "frontend-" in instance["title"]: if "frontend-" in instance["title"]:
try: try:
frontend = [instance["title"].replace("frontend-", ""), frontend = [instance["title"].replace("frontend-", ""),
...@@ -391,7 +402,9 @@ class SlapOSTester(SlapOSMasterCommunicator): ...@@ -391,7 +402,9 @@ class SlapOSTester(SlapOSMasterCommunicator):
password = connection_json["inituser-password"] password = connection_json["inituser-password"]
except Exception as e: except Exception as e:
raise ValueError("user and password not found in connection parameters. Error while instantiating?") raise ValueError("user and password not found in connection parameters. Error while instantiating?")
return {'user' : user, 'password' : password, 'frontend-url-list' : frontend_url_list } return {'user' : user, 'password' : password, \
'frontend-url-list' : frontend_url_list, \
'balancer-user-v6': balancer_user_v6 }
def destroyInstance(self, instance_title): def destroyInstance(self, instance_title):
self.name = instance_title self.name = instance_title
......
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