Commit f3d07c2f authored by Jérome Perrin's avatar Jérome Perrin

testnode: setup SlapOS for test suite only at test startup

Our test nodes were installing seleniumrunner software in a loop, which
uses a lot of resources on the git repository and on the testnode
itself. Now that it's done only once at startup, this should reduce the
load a lot, but updates to seleniumrunnner profile needs to restart test
nodes.

Also add methods on taskdistributor.DummyTaskDistributor so that
ScalabilityTest slapos test node can be prepared.
parent c0ac5f74
......@@ -1103,6 +1103,8 @@ shared = true
original_updateDictionaryFile = RunnerClass.updateDictionaryFile
original__createInstance = RunnerClass._createInstance
original__waitInstanceCreation = RunnerClass._waitInstanceCreation
# for TestNode.setUp setting up all test types
original_UnitTest_prepareSlapOSForTestNode = test_type_registry['UnitTest'].prepareSlapOSForTestNode
time.sleep = doNothing
TaskDistributor.getSlaposAccountKey = patch_getSlaposAccountKey
......@@ -1126,6 +1128,8 @@ shared = true
RunnerClass.getDictionaryFromFile = patch_getDictionaryFromFile
RunnerClass._createInstance = doNothing
RunnerClass._waitInstanceCreation = doNothing
test_type_registry['UnitTest'].prepareSlapOSForTestNode = doNothing
try:
# Run
test_node = self.getTestNode()
......@@ -1154,3 +1158,4 @@ shared = true
RunnerClass.updateDictionaryFile = original_updateDictionaryFile
RunnerClass._createInstance = original__createInstance
RunnerClass._waitInstanceCreation = original__waitInstanceCreation
test_type_registry['UnitTest'].prepareSlapOSForTestNode = original_UnitTest_prepareSlapOSForTestNode
\ No newline at end of file
......@@ -547,3 +547,14 @@ class DummyTaskDistributor(object):
def isTaskAlive(self, *args):
return int(bool(self.test_name_list))
def getSlaposAccountKey(self):
return ''
def getSlaposAccountCertificate(self):
return ''
def getSlaposHateoasUrl(self):
return ''
def isMasterTestnode(self, test_node_title):
return False
......@@ -249,10 +249,23 @@ shared = true
self._cleanupLog()
self._cleanupTemporaryFiles()
def setUp(self):
test_node_slapos = SlapOSInstance(self.config['slapos_directory'])
self.taskdistribution = taskdistribution.TaskDistributor(
self.config['test_suite_master_url'],
logger=logger)
for runner_type, runner_class in test_type_registry.items():
logger.info("Preparing SlapOS for test node for runner type %s", runner_type)
runner = runner_class(self)
runner.prepareSlapOSForTestNode(test_node_slapos)
def run(self):
self.setUp()
config = self.config
portal_url = config['test_suite_master_url']
test_node_slapos = SlapOSInstance(config['slapos_directory'])
try:
while True:
test_result = None
......@@ -260,9 +273,7 @@ shared = true
node_test_suite = None
self.cleanUp()
begin = time.time()
taskdistributor = taskdistribution.TaskDistributor(
portal_url, logger=logger)
self.taskdistribution = taskdistributor
taskdistributor = self.taskdistribution
node_configuration = taskdistributor.subscribeNode(
node_title=config['test_node_title'],
computer_guid=config['computer_id'])
......@@ -300,8 +311,6 @@ shared = true
raise NotImplementedError
runner = runner_class(self)
logger.info("Type of current test is %s", my_test_type)
# master testnode gets test_suites, slaves get nothing
runner.prepareSlapOSForTestNode(test_node_slapos)
# Clean-up test suites
self.purgeOldTestSuite(test_suite_data)
for test_suite in test_suite_data:
......
  • This seem to work, but slapos proxy process (for test node, not for test suite) is not killled when erp5testnode is restarted.

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