Commit d0d81795 authored by Benjamin Blanc's avatar Benjamin Blanc

Patch testERP5testnode

parent de127a95
...@@ -513,7 +513,9 @@ branch = foo ...@@ -513,7 +513,9 @@ branch = foo
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_type_test)
# Patch # Patch
original_startTestSuite = TaskDistributor.startTestSuite original_startTestSuite = TaskDistributor.startTestSuite
original_subscribeNode = TaskDistributor.subscribeNode
TaskDistributor.startTestSuite = patch_startTestSuite TaskDistributor.startTestSuite = patch_startTestSuite
TaskDistributor.subscribeNode = doNothing
original_createTestResult = TaskDistributionTool.createTestResult original_createTestResult = TaskDistributionTool.createTestResult
TaskDistributionTool.createTestResult = patch_createTestResult TaskDistributionTool.createTestResult = patch_createTestResult
# TestNode # TestNode
...@@ -531,6 +533,7 @@ branch = foo ...@@ -531,6 +533,7 @@ branch = foo
# Restore old class methods # Restore old class methods
TaskDistributor.startTestSuite = original_startTestSuite TaskDistributor.startTestSuite = original_startTestSuite
TaskDistributionTool.createTestResult = original_createTestResult TaskDistributionTool.createTestResult = original_createTestResult
TaskDistributionTool.subscribeNode = original_subscribeNode
RunnerClass._prepareSlapOS = original_prepareSlapOS RunnerClass._prepareSlapOS = original_prepareSlapOS
RunnerClass.runTestSuite = original_runTestSuite RunnerClass.runTestSuite = original_runTestSuite
...@@ -620,7 +623,9 @@ branch = foo ...@@ -620,7 +623,9 @@ branch = foo
time.sleep = doNothing time.sleep = doNothing
self.generateTestRepositoryList() self.generateTestRepositoryList()
original_startTestSuite = TaskDistributor.startTestSuite original_startTestSuite = TaskDistributor.startTestSuite
original_subscribeNode = TaskDistributor.subscribeNode
TaskDistributor.startTestSuite = patch_startTestSuite TaskDistributor.startTestSuite = patch_startTestSuite
TaskDistributor.subscribeNode = patch_subscribeNode
original_createTestResult = TaskDistributionTool.createTestResult original_createTestResult = TaskDistributionTool.createTestResult
TaskDistributionTool.createTestResult = patch_createTestResult TaskDistributionTool.createTestResult = patch_createTestResult
test_node = self.getTestNode() test_node = self.getTestNode()
...@@ -637,6 +642,7 @@ branch = foo ...@@ -637,6 +642,7 @@ branch = foo
# Restore old class methods # Restore old class methods
TaskDistributor.startTestSuite = original_startTestSuite TaskDistributor.startTestSuite = original_startTestSuite
TaskDistributionTool.createTestResult = original_createTestResult TaskDistributionTool.createTestResult = original_createTestResult
TaskDistributionTool.subscribeNode = original_subscribeNode
RunnerClass._prepareSlapOS = original_prepareSlapOS RunnerClass._prepareSlapOS = original_prepareSlapOS
RunnerClass.runTestSuite = original_runTestSuite RunnerClass.runTestSuite = original_runTestSuite
......
...@@ -190,6 +190,38 @@ class ERP5ProjectUnitTestDistributor(XMLObject): ...@@ -190,6 +190,38 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
"task_distribution", "default_memcached_plugin") "task_distribution", "default_memcached_plugin")
return memcached_dict return memcached_dict
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("startTestSuite") security.declarePublic("startTestSuite")
def startTestSuite(self,title, batch_mode=0): def startTestSuite(self,title, batch_mode=0):
""" """
......
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