Commit 0389e5f5 authored by Sebastien Robin's avatar Sebastien Robin

erp5testnode: runTestSuite should be launched within the test suite sub folder

parent 1f541a2d
...@@ -5,6 +5,7 @@ from erp5.util.testnode.testnode import SlapOSInstance ...@@ -5,6 +5,7 @@ from erp5.util.testnode.testnode import SlapOSInstance
from erp5.util.testnode.ProcessManager import ProcessManager, SubprocessError from erp5.util.testnode.ProcessManager import ProcessManager, SubprocessError
from erp5.util.testnode.SlapOSControler import SlapOSControler from erp5.util.testnode.SlapOSControler import SlapOSControler
from erp5.util.testnode.SlapOSControler import createFolder
from erp5.util.taskdistribution import TaskDistributor from erp5.util.taskdistribution import TaskDistributor
from erp5.util.taskdistribution import TaskDistributionTool from erp5.util.taskdistribution import TaskDistributionTool
from erp5.util.taskdistribution import TestResultProxy from erp5.util.taskdistribution import TestResultProxy
...@@ -159,6 +160,8 @@ class ERP5TestNode(TestCase): ...@@ -159,6 +160,8 @@ class ERP5TestNode(TestCase):
node_test_suite.edit(working_directory=self.working_directory) node_test_suite.edit(working_directory=self.working_directory)
self.assertEquals("%s/foo" % self.working_directory, self.assertEquals("%s/foo" % self.working_directory,
node_test_suite.working_directory) node_test_suite.working_directory)
self.assertEquals("%s/foo/test_suite" % self.working_directory,
node_test_suite.test_suite_directory)
def test_03_NodeTestSuiteCheckDataAfterEdit(self): def test_03_NodeTestSuiteCheckDataAfterEdit(self):
""" """
...@@ -476,3 +479,18 @@ branch = foo ...@@ -476,3 +479,18 @@ branch = foo
self.assertEquals([file_name], os.listdir(controler.software_root)) self.assertEquals([file_name], os.listdir(controler.software_root))
controler._resetSoftware() controler._resetSoftware()
self.assertEquals([], os.listdir(controler.software_root)) self.assertEquals([], os.listdir(controler.software_root))
def test_14_createFolder(self):
test_node = self.getTestNode()
node_test_suite = test_node.getNodeTestSuite('foo')
node_test_suite.edit(working_directory=self.working_directory)
folder = node_test_suite.test_suite_directory
self.assertEquals(False, os.path.exists(folder))
createFolder(folder)
self.assertEquals(True, os.path.exists(folder))
to_drop_path = os.path.join(folder, 'drop')
to_drop = open(to_drop_path, 'w')
to_drop.close()
self.assertEquals(True, os.path.exists(to_drop_path))
createFolder(folder, clean=True)
self.assertEquals(False, os.path.exists(to_drop_path))
...@@ -36,7 +36,9 @@ import glob ...@@ -36,7 +36,9 @@ import glob
MAX_PARTIONS = 10 MAX_PARTIONS = 10
MAX_SR_RETRIES = 3 MAX_SR_RETRIES = 3
def createFolder(folder): def createFolder(folder, clean=False):
if clean and os.path.exists(folder):
shutil.rmtree(folder)
if not(os.path.exists(folder)): if not(os.path.exists(folder)):
os.mkdir(folder) os.mkdir(folder)
......
...@@ -93,6 +93,8 @@ class NodeTestSuite(SlapOSInstance): ...@@ -93,6 +93,8 @@ class NodeTestSuite(SlapOSInstance):
self.working_directory = os.path.join(self.working_directory, self.working_directory = os.path.join(self.working_directory,
self.reference) self.reference)
SlapOSControler.createFolder(self.working_directory) SlapOSControler.createFolder(self.working_directory)
self.test_suite_directory = os.path.join(
self.working_directory, "test_suite")
self.custom_profile_path = os.path.join(self.working_directory, self.custom_profile_path = os.path.join(self.working_directory,
'software.cfg') 'software.cfg')
if getattr(self, "vcs_repository_list", None) is not None: if getattr(self, "vcs_repository_list", None) is not None:
...@@ -325,8 +327,10 @@ branch = %(branch)s ...@@ -325,8 +327,10 @@ branch = %(branch)s
# From this point, test runner becomes responsible for updating test # From this point, test runner becomes responsible for updating test
# result. We only do cleanup if the test runner itself is not able # result. We only do cleanup if the test runner itself is not able
# to run. # to run.
SlapOSControler.createFolder(node_test_suite.test_suite_directory,
clean=True)
self.process_manager.spawn(*invocation_list, self.process_manager.spawn(*invocation_list,
cwd=config['test_suite_directory'], cwd=node_test_suite.test_suite_directory,
log_prefix='runTestSuite', get_output=False) log_prefix='runTestSuite', get_output=False)
def cleanUp(self,test_result): def cleanUp(self,test_result):
......
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