Commit 50a05e70 authored by Benjamin Blanc's avatar Benjamin Blanc

util: testnode up

parent aa243abb
......@@ -113,18 +113,19 @@ class ScalabilityLauncher(object):
def run(self):
self.log("Scalability Launcher started")
max_time = 10
max_time = 10
start_time = time.time()
error_message_set, exit_status = set(), 0
self.log("%s", self.test_result.isAlive())
#self.log("%s", self.test_result.isAlive())
while time.time()-start_time < max_time:
current_test = self._getNextTest()
current_test.dump()
time.sleep(2)
# Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ?
return error_message_set, exit_status
def main():
......
......@@ -201,6 +201,10 @@ class TestResultProxy(RPCRetry):
return '<%s(%r, %r, %r) at %x>' % (self.__class__.__name__,
self._test_result_path, self._node_title, self._revision, id(self))
@property
def test_result_path(self):
return self._test_result_path
@property
def revision(self):
return self._revision
......@@ -360,7 +364,7 @@ class TestResultProxyProxy(TestResultProxy):
proxy = ServerProxy(
portal_url,
allow_none=True,
).test_result_module
)
except:
raise ValueError("Cannot instanciate ServerProxy")
TestResultProxy.__init__(self, proxy, retry_time, logger, test_result_path,
......
......@@ -117,8 +117,8 @@ class ScalabilityTestRunner():
Create scalability instance
"""
if self.authorize_request:
config = _generateInstanceXML(software_path, software_configuration,
instance_title, test_result)
config = self._generateInstanceXML(software_path, software_configuration,
test_result)
self.log("testnode, request : %s", instance_title)
self.slapos_controler.request(instance_title, software_path,
"scalability", {"_" : config})
......@@ -207,7 +207,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self.launchable = test_configuration['launchable']
self.error_message = test_configuration['error_message']
self.randomized_path = test_configuration['randomized_path']
# Avoid the test if it is not launchable
if not self.launchable:
self.log("Test suite %s is not actually launchable with \
......@@ -215,21 +214,13 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self.log("ERP5 Master indicates : %s" %(self.error_message,))
# error : wich code to return ?
return {'status_code' : 1}
# create an obfuscated link to the testsuite directory
self.log("self.testnode.config['software_directory']\
: %s" %(self.testnode.config['software_directory']))
self.log("self.randomized_path\
: %s" %(self.randomized_path))
path_to_suite = os.path.join(
self.testnode.config['working_directory'],
node_test_suite.reference)
self.log("path_to_suite\
: %s" %(path_to_suite))
self.ofuscated_link_path = os.path.join(
self.testnode.config['software_directory'],
self.randomized_path)
if ( not os.path.lexists(self.ofuscated_link_path) and
not os.path.exists(self.ofuscated_link_path) ) :
try :
......@@ -239,12 +230,10 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
except :
self.log("testnode, Unable to create symbolic link to the testsuite.")
raise ValueError("testnode, Unable to create symbolic link to the testsuite.")
self.log("Sym link : %s %s" %(path_to_suite, self.ofuscated_link_path))
involved_nodes_computer_guid = test_configuration['involved_nodes_computer_guid']
configuration_list = test_configuration['configuration_list']
node_test_suite.edit(configuration_list=configuration_list)
self.launcher_nodes_computer_guid = test_configuration['launcher_nodes_computer_guid']
software_path_list = []
# Construct the ipv6 obfuscated url of the software profile reachable from outside
......@@ -276,30 +265,42 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
return {'status_code' : 1}
self.authorize_request = True
self.log("Softwares installed")
try:
""" try:
"""
# Launch instance
instance_title = self._generateInstancetitle(node_test_suite.test_suite_title)
self._createInstance(self.reachable_profile, configuration_list[0],
instance_title, node_test_suite.test_result)
self.log("Scalability instance requested")
time.sleep(15)
self.log("Trying to update instance XML...")
time.sleep(2)
try:
self._updateInstanceXML(self.reachable_profile, "COMP-1564", configuration_list[1])
self.log("Instance XML updated...")
except:
raise ValueError("Unable to update instance XML")
return {'status_code' : 1}
except:
instance_title = self._generateInstancetitle(node_test_suite.test_suite_title)
self._createInstance(self.reachable_profile, configuration_list[0],
instance_title, node_test_suite.test_result)
self.log("Scalability instance requested")
""" except:
self.log("Unable to launch instance")
raise ValueError("Unable to launch instance")
return {'status_code' : 1}
return {'status_code' : 1} # Unbale to launch instance
"""
return {'status_code' : 1} # Unable to continue due to not realizable configuration
return {'status_code' : 0}
def runTestSuite(self, node_test_suite, portal_url):
configuration_list = node_test_suite.configuration_list
test_list = [ configuration_list.index(configuration)
for configuration in configuration_list ]
# create test_result
test_result_proxy = self.testnode.portal.createTestResult(
node_test_suite.revision, test_list,
self.testnode.config['test_node_title'],
True, node_test_suite.test_suite_title,
node_test_suite.project_title)
count = 0
for configuration in configuration_list:
# Start only the current test
exclude_list=[x for x in test_list if x!=test_list[count]]
count += 1
test_result_line_proxy = test_result_proxy.start(exclude_list)
self.log("Test for count : %d is in a running state." %count)
# create result line
return {'status_code' : 0}
def _cleanUpNodesInformation(self):
self.involved_nodes_computer_guid = []
self.launcher_nodes_computer_guid = []
......@@ -307,13 +308,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self.authorize_supply = True
self.authorize_request = False
def runTestSuite(self, node_test_suite, portal_url, log=None):
# TODO : write code
SlapOSControler.createFolder(node_test_suite.test_suite_directory,
clean=True)
# create ResultLine for each loop
pass
def getRelativePathUsage(self):
"""
Used by the method testnode.constructProfile() to know
......
......@@ -139,6 +139,7 @@ class UnitTestRunner():
invocation_list.extend(["--firefox_bin", firefox_bin_list[0]])
if '--xvfb_bin' in supported_paramater_set:
invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]])
# TODO : include testnode correction ( b111682f14890bf )
bt5_path_list = config.get("bt5_path")
if bt5_path_list not in ('', None,):
invocation_list.extend(["--bt5_path", bt5_path_list])
......
......@@ -290,8 +290,6 @@ branch = %(branch)s
self._cleanupTemporaryFiles()
def run(self):
## BLOCK OK
log = self.log
config = self.config
slapgrid = None
......@@ -300,7 +298,6 @@ branch = %(branch)s
test_result = None
test_node_slapos = SlapOSInstance()
test_node_slapos.edit(working_directory=self.config['slapos_directory'])
## /BLOCK OK
try:
while True:
try:
......@@ -311,15 +308,13 @@ branch = %(branch)s
begin = time.time()
portal_url = config['test_suite_master_url']
portal = taskdistribution.TaskDistributionTool(portal_url, logger=DummyLogger(log))
self.portal = portal
self.test_suite_portal = taskdistribution.TaskDistributor(portal_url, logger=DummyLogger(log))
self.test_suite_portal.subscribeNode(config['test_node_title'], config['computer_id'])
test_suite_json = self.test_suite_portal.startTestSuite(config['test_node_title'])
test_suite_data = testnodeUtils.deunicodeData(json.loads(test_suite_json))
log("Got following test suite data from master : %r" % \
(test_suite_data,))
# TODO : implement this method for each distributor
# into nexedi/master-erp5..
try:
......@@ -340,11 +335,7 @@ from the distributor.")
# master testnode gets test_suites, slaves get nothing
runner.prepareSlapOSForTestNode(test_node_slapos)
# Clean-up test suites
self.checkOldTestSuite(test_suite_data)
for test_suite in test_suite_data:
remote_test_result_needs_cleanup = False
node_test_suite = self.getNodeTestSuite(
......@@ -366,20 +357,16 @@ from the distributor.")
node_test_suite.project_title)
remote_test_result_needs_cleanup = True
log("testnode, test_result : %r" % (test_result, ))
if test_result is not None:
self.registerSuiteLog(test_result, node_test_suite)
self.checkRevision(test_result,node_test_suite)
node_test_suite.edit(test_result=test_result)
# Now prepare the installation of SlapOS and create instance
status_dict = runner.prepareSlapOSForTestSuite(node_test_suite)
# Give some time so computer partitions may start
# as partitions can be of any kind we have and likely will never have
# a reliable way to check if they are up or not ...
time.sleep(20)
node_test_suite.test_result = test_result
#time.sleep(20)
runner.runTestSuite(node_test_suite, portal_url)
# break the loop to get latest priorities from master
break
......
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