Commit cf09f030 authored by Sebastien Robin's avatar Sebastien Robin

task_distribution: increase the maximum testnodes for test suite having high priority

Before we were using up to 10 testnodes per test suite. Push it to 15 testnodes to have
chance to run big test suite (like whole ERP5 tests) in less than 2 hours.
parent 7cc3d26d
...@@ -351,9 +351,10 @@ class TestTaskDistribution(ERP5TypeTestCase): ...@@ -351,9 +351,10 @@ class TestTaskDistribution(ERP5TypeTestCase):
config_list = json.loads(self.distributor.startTestSuite( config_list = json.loads(self.distributor.startTestSuite(
title="COMP%s-Node1" % x)) title="COMP%s-Node1" % x))
test_suite_list = self._createTestSuite(quantity=3) test_suite_list = self._createTestSuite(quantity=3)
test_suite_list[0].setIntIndex(1) # test suite 1 test_suite_1, test_suite_2, test_suite_3 = test_suite_list
test_suite_list[1].setIntIndex(5) # test suite 2 test_suite_list[0].setIntIndex(1) # test suite 1, up to 1 testnode
test_suite_list[2].setIntIndex(9) # test suite 3 test_suite_list[1].setIntIndex(5) # test suite 2, up to 5 testnodes
test_suite_list[2].setIntIndex(8) # test suite 3, up to 10 testnodes
self.tic() self.tic()
self._callOptimizeAlarm() self._callOptimizeAlarm()
...@@ -362,23 +363,24 @@ class TestTaskDistribution(ERP5TypeTestCase): ...@@ -362,23 +363,24 @@ class TestTaskDistribution(ERP5TypeTestCase):
title=title)) title=title))
return ["%s" % x["test_suite_title"] for x in config_list] return ["%s" % x["test_suite_title"] for x in config_list]
now = DateTime() now = DateTime()
def affectTestSuite(node_title, test_suite_list):
test_node, = self.test_node_module.searchFolder(title=node_title)
test_node = test_node.getObject()
test_node.setAggregateValueList(test_suite_list)
try: try:
# Check test suite distribution. This is not the purpose of this test # Take a distribution that was calculated by alarm at some point. Though
# initially, distribution might later change if algorithm is modified. # hardcode the distribution, because this is not the purpose of this test
# Though next steps of the test depends on distribution, thus we have # to check purpose algorithm
# to make sure test does not fails only due to a change of distribution affectTestSuite("COMP0-Node1", [test_suite_1, test_suite_2, test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP0-Node1")), set(["test suite 1", "test suite 2", "test suite 3"])) affectTestSuite("COMP1-Node1", [test_suite_2, test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP1-Node1")), set(["test suite 2", "test suite 3"])) affectTestSuite("COMP2-Node1", [test_suite_2, test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP2-Node1")), set(["test suite 2", "test suite 3"])) affectTestSuite("COMP3-Node1", [test_suite_2, test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP3-Node1")), set(["test suite 2", "test suite 3"])) affectTestSuite("COMP4-Node1", [test_suite_3])
# COMP4 as less than COMP5 only due to distribution algorithm, though affectTestSuite("COMP5-Node1", [test_suite_2, test_suite_3])
# this is not an issue at all affectTestSuite("COMP6-Node1", [test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP4-Node1")), set(["test suite 3"])) affectTestSuite("COMP7-Node1", [test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP5-Node1")), set(["test suite 2", "test suite 3"])) affectTestSuite("COMP8-Node1", [test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP6-Node1")), set(["test suite 3"])) affectTestSuite("COMP9-Node1", [test_suite_3])
self.assertEquals(set(getTestSuiteList("COMP7-Node1")), set(["test suite 3"]))
self.assertEquals(set(getTestSuiteList("COMP8-Node1")), set(["test suite 3"]))
self.assertEquals(set(getTestSuiteList("COMP9-Node1")), set(["test suite 3"]))
# process some test to have old test result in database # process some test to have old test result in database
self.processTest("test suite 1", "r0=a", node_title="COMP0-Node1") self.processTest("test suite 1", "r0=a", node_title="COMP0-Node1")
self.pinDateTime(now + 1.0/86400) self.pinDateTime(now + 1.0/86400)
......
...@@ -49,9 +49,9 @@ PRIORITY_MAPPING = { ...@@ -49,9 +49,9 @@ PRIORITY_MAPPING = {
4: ( 6, 12), 4: ( 6, 12),
5: ( 9, 15), 5: ( 9, 15),
6: ( 9, 18), 6: ( 9, 18),
7: ( 12, 18), 7: ( 12, 24),
8: ( 15, 24), 8: ( 15, 30),
9: ( 18, 30), 9: ( 18, 45),
} }
class ERP5ProjectUnitTestDistributor(XMLObject): class ERP5ProjectUnitTestDistributor(XMLObject):
...@@ -331,7 +331,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject): ...@@ -331,7 +331,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# priority and the more test result lack test node, the lower is key[0] # priority and the more test result lack test node, the lower is key[0]
# This allows to affect more test nodes to test suites with higher priority # This allows to affect more test nodes to test suites with higher priority
wanted_test_core_quantity = PRIORITY_MAPPING[test_suite.getIntIndex()][1] wanted_test_core_quantity = PRIORITY_MAPPING[test_suite.getIntIndex()][1]
factor = max_test_core_per_suite / wanted_test_core_quantity factor = float(max_test_core_per_suite) / wanted_test_core_quantity
missing_quantity = wanted_test_core_quantity/3 - len(test_result.objectValues(portal_type="Test Result Node")) missing_quantity = wanted_test_core_quantity/3 - len(test_result.objectValues(portal_type="Test Result Node"))
key = (max_test_core_per_suite - missing_quantity * 3 * factor, modification_date) key = (max_test_core_per_suite - missing_quantity * 3 * factor, modification_date)
else: else:
......
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