Commit 77763bcf authored by Benjamin Blanc's avatar Benjamin Blanc

erp5_test_result: update ERP5Scalabilitydistributor and add tests

parent 3026d87e
...@@ -57,13 +57,8 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -57,13 +57,8 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
# Get lists of test node wich belong to the current distributor # Get lists of test node wich belong to the current distributor
all_test_node_list = test_node_module.searchFolder( all_test_node_list = test_node_module.searchFolder(
portal_type="Test Node", specialise_uid=self.getUid()) portal_type="Test Node", specialise_uid=self.getUid())
test_node_list = [ x.getObject() for x in all_test_node_list if x.validationState() == 'validated' ] test_node_list = [ x.getObject() for x in all_test_node_list if x.getValidationState() == 'validated' ]
invalid_test_node_list = [ x.getObject() for x in all_test_node_list if x.validationState() != 'validated' ] invalid_test_node_list = [ x.getObject() for x in all_test_node_list if x.getValidationState() != 'validated' ]
log("test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in test_node_list])
log("invalid_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in invalid_test_node_list])
# Set master property to False for all invalid testnode # Set master property to False for all invalid testnode
for node in invalid_test_node_list: for node in invalid_test_node_list:
...@@ -73,17 +68,9 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -73,17 +68,9 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
slave_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()!=True ] slave_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()!=True ]
master_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()==True ] master_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()==True ]
# Set to 'False' slaves
log("---2--") for node in slave_test_node_list:
log("test_node_list:") node.setMaster(False)
log([(x.getTitle(), x.getMaster()) for x in test_node_list])
log("invalid_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in invalid_test_node_list])
log("slave_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in slave_test_node_list])
log("master_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in master_test_node_list])
# if there is validated testnodes # if there is validated testnodes
if len(test_node_list) > 0: if len(test_node_list) > 0:
...@@ -102,16 +89,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -102,16 +89,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
slave_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()!=True ] slave_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()!=True ]
master_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()==True ] master_test_node_list = [ x.getObject() for x in test_node_list if x.getMaster()==True ]
log("---3--")
log("test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in test_node_list])
log("invalid_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in invalid_test_node_list])
log("slave_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in slave_test_node_list])
log("master_test_node_list:")
log([(x.getTitle(), x.getMaster()) for x in master_test_node_list])
# Get test suites and aggregate them to all valid testnode # Get test suites and aggregate them to all valid testnode
test_suite_list = [ x.getTitle() for x in test_suite_module.searchFolder( test_suite_list = [ x.getTitle() for x in test_suite_module.searchFolder(
portal_type="Scalability Test Suite", portal_type="Scalability Test Suite",
...@@ -119,8 +96,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -119,8 +96,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
for test_node in test_node_list: for test_node in test_node_list:
test_node.setAggregateList(test_suite_list) test_node.setAggregateList(test_suite_list)
security.declarePublic("getInvolvedNodeList") security.declarePublic("getInvolvedNodeList")
def getInvolvedNodeList(self): def getInvolvedNodeList(self):
""" """
...@@ -132,36 +107,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -132,36 +107,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
involved_nodes = involved_nodes + [ x.getObject() for x in test_node_module.searchFolder(validation_state='validated') if ( x.getSpecialiseTitle() == distributor_title ) ] involved_nodes = involved_nodes + [ x.getObject() for x in test_node_module.searchFolder(validation_state='validated') if ( x.getSpecialiseTitle() == distributor_title ) ]
return involved_nodes return involved_nodes
security.declarePublic("subscribeNode")
def subscribeNode(self,title,computer_guid,batch_mode=0):
"""
subscribeNode doc
"""
test_node_module = self._getTestNodeModule()
portal = self.getPortalObject()
tag = "%s_%s" % (self.getRelativeUrl(), title)
if portal.portal_activities.countMessageWithTag(tag) == 0:
test_node_list = test_node_module.searchFolder(portal_type="Test Node",title=title)
assert len(test_node_list) in (0, 1), "Unable to find testnode : %s" % title
test_node = None
if len(test_node_list) == 1:
test_node = test_node_list[0].getObject()
if test_node.getValidationState() != 'validated':
try:
test_node.validate()
except e:
LOG('Test Node Validate',ERROR,'%s' %e)
if test_node is None:
test_node = test_node_module.newContent(portal_type="Test Node", title=title, computer_guid=computer_guid,
specialise=self.getRelativeUrl(),
activate_kw={'tag': tag})
self.activate(after_tag=tag).optimizeConfiguration()
test_node.setPingDate()
return test_node
return None
security.declarePublic("getTestNode") security.declarePublic("getTestNode")
def getTestNode(self,title,batch_mode=0): def getTestNode(self,title,batch_mode=0):
""" """
...@@ -201,7 +146,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -201,7 +146,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
else: else:
return False return False
security.declarePublic("getTestType") security.declarePublic("getTestType")
def getTestType(self, batch_mode=0): def getTestType(self, batch_mode=0):
""" """
...@@ -209,7 +153,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -209,7 +153,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
""" """
return 'ScalabilityTest' return 'ScalabilityTest'
security.declarePublic("startTestSuite") security.declarePublic("startTestSuite")
def startTestSuite(self,title, batch_mode=0): def startTestSuite(self,title, batch_mode=0):
""" """
......
263 264
\ No newline at end of file \ No newline at end of file
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