Commit f9b08acc authored by Benjamin Blanc's avatar Benjamin Blanc

Fix typo (definitively : my_test_type)

parent 366b0144
...@@ -157,7 +157,7 @@ class ERP5TestNode(TestCase): ...@@ -157,7 +157,7 @@ class ERP5TestNode(TestCase):
# ['4f1d14de1b04b4f878a442ee859791fa337bcf85', 'first_commit']]} # ['4f1d14de1b04b4f878a442ee859791fa337bcf85', 'first_commit']]}
return commit_dict return commit_dict
def test_01_getDelNodeTestSuite(self, my_type_test='UnitTest'): def test_01_getDelNodeTestSuite(self, my_test_type='UnitTest'):
""" """
We should be able to get/delete NodeTestSuite objects inside test_node We should be able to get/delete NodeTestSuite objects inside test_node
""" """
...@@ -170,7 +170,7 @@ class ERP5TestNode(TestCase): ...@@ -170,7 +170,7 @@ class ERP5TestNode(TestCase):
node_test_suite = test_node.getNodeTestSuite('foo') node_test_suite = test_node.getNodeTestSuite('foo')
self.assertEquals(0, node_test_suite.retry_software_count) self.assertEquals(0, node_test_suite.retry_software_count)
def test_02_NodeTestSuiteWorkingDirectory(self, my_type_test='UnitTest'): def test_02_NodeTestSuiteWorkingDirectory(self, my_test_type='UnitTest'):
""" """
Make sure we extend the working path with the node_test_suite reference Make sure we extend the working path with the node_test_suite reference
""" """
...@@ -182,7 +182,7 @@ class ERP5TestNode(TestCase): ...@@ -182,7 +182,7 @@ class ERP5TestNode(TestCase):
self.assertEquals("%s/foo/test_suite" % self.working_directory, self.assertEquals("%s/foo/test_suite" % self.working_directory,
node_test_suite.test_suite_directory) node_test_suite.test_suite_directory)
def test_03_NodeTestSuiteCheckDataAfterEdit(self, my_type_test='UnitTest'): def test_03_NodeTestSuiteCheckDataAfterEdit(self, my_test_type='UnitTest'):
""" """
When a NodeTestSuite instance is edited, the method _checkData When a NodeTestSuite instance is edited, the method _checkData
analyse properties and add new ones analyse properties and add new ones
...@@ -198,7 +198,7 @@ class ERP5TestNode(TestCase): ...@@ -198,7 +198,7 @@ class ERP5TestNode(TestCase):
"%s/rep1" % node_test_suite.working_directory] "%s/rep1" % node_test_suite.working_directory]
self.assertEquals(expected_list, repository_path_list) self.assertEquals(expected_list, repository_path_list)
def test_04_constructProfile(self, my_type_test='UnitTest'): def test_04_constructProfile(self, my_test_type='UnitTest'):
""" """
Check if the software profile is correctly generated Check if the software profile is correctly generated
""" """
...@@ -224,7 +224,7 @@ branch = foo ...@@ -224,7 +224,7 @@ branch = foo
self.assertEquals(expected_profile, profile.read()) self.assertEquals(expected_profile, profile.read())
profile.close() profile.close()
def test_05_getAndUpdateFullRevisionList(self, my_type_test='UnitTest'): def test_05_getAndUpdateFullRevisionList(self, my_test_type='UnitTest'):
""" """
Check if we clone correctly repositories and get right revisions Check if we clone correctly repositories and get right revisions
""" """
...@@ -248,7 +248,7 @@ branch = foo ...@@ -248,7 +248,7 @@ branch = foo
for vcs_repository in node_test_suite.vcs_repository_list: for vcs_repository in node_test_suite.vcs_repository_list:
self.assertTrue(os.path.exists(vcs_repository['repository_path'])) self.assertTrue(os.path.exists(vcs_repository['repository_path']))
def test_05b_changeRepositoryBranch(self, my_type_test='UnitTest'): def test_05b_changeRepositoryBranch(self, my_test_type='UnitTest'):
""" """
It could happen that the branch is changed for a repository. Testnode must It could happen that the branch is changed for a repository. Testnode must
be able to reset correctly the branch be able to reset correctly the branch
...@@ -283,7 +283,7 @@ branch = foo ...@@ -283,7 +283,7 @@ branch = foo
output = call("git branch".split()).strip() output = call("git branch".split()).strip()
self.assertTrue("* bar" in output.split('\n')) self.assertTrue("* bar" in output.split('\n'))
def test_06_checkRevision(self, my_type_test='UnitTest'): def test_06_checkRevision(self, my_test_type='UnitTest'):
""" """
Check if we are able to restore older commit hash if master decide so Check if we are able to restore older commit hash if master decide so
""" """
...@@ -320,7 +320,7 @@ branch = foo ...@@ -320,7 +320,7 @@ branch = foo
self.assertEquals([commit_dict['rep0'][0][0],commit_dict['rep1'][1][0]], self.assertEquals([commit_dict['rep0'][0][0],commit_dict['rep1'][1][0]],
getRepInfo(hash=1)) getRepInfo(hash=1))
def test_07_checkExistingTestSuite(self, my_type_test='UnitTest'): def test_07_checkExistingTestSuite(self, my_test_type='UnitTest'):
test_node = self.getTestNode() test_node = self.getTestNode()
test_suite_data = self.getTestSuiteData(add_third_repository=True) test_suite_data = self.getTestSuiteData(add_third_repository=True)
self.assertEquals([], os.listdir(self.working_directory)) self.assertEquals([], os.listdir(self.working_directory))
...@@ -336,7 +336,7 @@ branch = foo ...@@ -336,7 +336,7 @@ branch = foo
test_node.checkOldTestSuite(test_suite_data) test_node.checkOldTestSuite(test_suite_data)
self.assertEquals(['foo'], os.listdir(self.working_directory)) self.assertEquals(['foo'], os.listdir(self.working_directory))
def test_08_getSupportedParamaterSet(self, my_type_test='UnitTest'): def test_08_getSupportedParamaterSet(self, my_test_type='UnitTest'):
original_spawn = ProcessManager.spawn original_spawn = ProcessManager.spawn
try: try:
def get_help(self, *args, **kw): def get_help(self, *args, **kw):
...@@ -353,7 +353,7 @@ branch = foo ...@@ -353,7 +353,7 @@ branch = foo
finally: finally:
ProcessManager.spawn = original_spawn ProcessManager.spawn = original_spawn
def test_09_runTestSuite(self, my_type_test='UnitTest'): def test_09_runTestSuite(self, my_test_type='UnitTest'):
""" """
Check parameters passed to runTestSuite Check parameters passed to runTestSuite
Also make sure that --firefox_bin and --xvfb_bin are passed when needed Also make sure that --firefox_bin and --xvfb_bin are passed when needed
...@@ -377,7 +377,7 @@ branch = foo ...@@ -377,7 +377,7 @@ branch = foo
return [] return []
test_node = self.getTestNode() test_node = self.getTestNode()
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
runner = RunnerClass(test_node) runner = RunnerClass(test_node)
# Create and initialise/regenerate a nodetestsuite # Create and initialise/regenerate a nodetestsuite
node_test_suite = test_node.getNodeTestSuite('foo') node_test_suite = test_node.getNodeTestSuite('foo')
...@@ -390,7 +390,7 @@ branch = foo ...@@ -390,7 +390,7 @@ branch = foo
def checkRunTestSuiteParameters(additional_parameter_list=None): def checkRunTestSuiteParameters(additional_parameter_list=None):
ProcessManager.getSupportedParameterSet = patch_getSupportedParameterSet ProcessManager.getSupportedParameterSet = patch_getSupportedParameterSet
ProcessManager.spawn = get_parameters ProcessManager.spawn = get_parameters
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
runner = RunnerClass(test_node) runner = RunnerClass(test_node)
runner.runTestSuite(node_test_suite,"http://foo.bar") runner.runTestSuite(node_test_suite,"http://foo.bar")
expected_parameter_list = ['%s/a/bin/runTestSuite' expected_parameter_list = ['%s/a/bin/runTestSuite'
...@@ -416,10 +416,10 @@ branch = foo ...@@ -416,10 +416,10 @@ branch = foo
ProcessManager.getSupportedParameterSet = original_getSupportedParameter ProcessManager.getSupportedParameterSet = original_getSupportedParameter
ProcessManager.spawn = original_spawn ProcessManager.spawn = original_spawn
def test_10_prepareSlapOS(self, my_type_test='UnitTest'): def test_10_prepareSlapOS(self, my_test_type='UnitTest'):
test_node = self.getTestNode() test_node = self.getTestNode()
test_node_slapos = SlapOSInstance() test_node_slapos = SlapOSInstance()
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
runner = RunnerClass(test_node) runner = RunnerClass(test_node)
node_test_suite = test_node.getNodeTestSuite('foo') node_test_suite = test_node.getNodeTestSuite('foo')
node_test_suite.edit(working_directory=self.working_directory) node_test_suite.edit(working_directory=self.working_directory)
...@@ -457,11 +457,11 @@ branch = foo ...@@ -457,11 +457,11 @@ branch = foo
self.assertRaises(SubprocessError, runner.prepareSlapOSForTestSuite, self.assertRaises(SubprocessError, runner.prepareSlapOSForTestSuite,
node_test_suite) node_test_suite)
def test_11_run(self, my_type_test='UnitTest'): def test_11_run(self, my_test_type='UnitTest'):
def doNothing(self, *args, **kw): def doNothing(self, *args, **kw):
pass pass
def patch_getTestType(self): def patch_getTestType(self):
return my_type_test return my_test_type
test_self = self test_self = self
test_result_path_root = os.path.join(test_self._temp_dir,'test/results') test_result_path_root = os.path.join(test_self._temp_dir,'test/results')
os.makedirs(test_result_path_root) os.makedirs(test_result_path_root)
...@@ -512,7 +512,7 @@ branch = foo ...@@ -512,7 +512,7 @@ branch = foo
original_sleep = time.sleep original_sleep = time.sleep
time.sleep = doNothing time.sleep = doNothing
self.generateTestRepositoryList() self.generateTestRepositoryList()
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
# Patch # Patch
original_startTestSuite = TaskDistributor.startTestSuite original_startTestSuite = TaskDistributor.startTestSuite
original_subscribeNode = TaskDistributor.subscribeNode original_subscribeNode = TaskDistributor.subscribeNode
...@@ -542,7 +542,7 @@ branch = foo ...@@ -542,7 +542,7 @@ branch = foo
RunnerClass._prepareSlapOS = original_prepareSlapOS RunnerClass._prepareSlapOS = original_prepareSlapOS
RunnerClass.runTestSuite = original_runTestSuite RunnerClass.runTestSuite = original_runTestSuite
def test_12_spawn(self, my_type_test='UnitTest'): def test_12_spawn(self, my_test_type='UnitTest'):
def _checkCorrectStatus(expected_status,*args): def _checkCorrectStatus(expected_status,*args):
result = process_manager.spawn(*args) result = process_manager.spawn(*args)
self.assertEqual(result['status_code'], expected_status) self.assertEqual(result['status_code'], expected_status)
...@@ -552,7 +552,7 @@ branch = foo ...@@ -552,7 +552,7 @@ branch = foo
# it will be automatically killed # it will be automatically killed
self.assertRaises(SubprocessError, process_manager.spawn, 'sleep','3') self.assertRaises(SubprocessError, process_manager.spawn, 'sleep','3')
def test_13_SlaposControlerResetSoftware(self, my_type_test='UnitTest'): def test_13_SlaposControlerResetSoftware(self, my_test_type='UnitTest'):
test_node = self.getTestNode() test_node = self.getTestNode()
controler = SlapOSControler(self.working_directory, controler = SlapOSControler(self.working_directory,
test_node.config, self.log) test_node.config, self.log)
...@@ -564,7 +564,7 @@ branch = foo ...@@ -564,7 +564,7 @@ branch = foo
controler._resetSoftware() controler._resetSoftware()
self.assertEquals([], os.listdir(controler.software_root)) self.assertEquals([], os.listdir(controler.software_root))
def test_14_createFolder(self, my_type_test='UnitTest'): def test_14_createFolder(self, my_test_type='UnitTest'):
test_node = self.getTestNode() test_node = self.getTestNode()
node_test_suite = test_node.getNodeTestSuite('foo') node_test_suite = test_node.getNodeTestSuite('foo')
node_test_suite.edit(working_directory=self.working_directory) node_test_suite.edit(working_directory=self.working_directory)
...@@ -579,11 +579,11 @@ branch = foo ...@@ -579,11 +579,11 @@ branch = foo
createFolder(folder, clean=True) createFolder(folder, clean=True)
self.assertEquals(False, os.path.exists(to_drop_path)) self.assertEquals(False, os.path.exists(to_drop_path))
def test_15_suite_log_directory(self, my_type_test='UnitTest'): def test_15_suite_log_directory(self, my_test_type='UnitTest'):
def doNothing(self, *args, **kw): def doNothing(self, *args, **kw):
pass pass
def patch_getTestType(self): def patch_getTestType(self):
return my_type_test return my_test_type
test_self = self test_self = self
test_result_path_root = os.path.join(test_self._temp_dir,'test/results') test_result_path_root = os.path.join(test_self._temp_dir,'test/results')
os.makedirs(test_result_path_root) os.makedirs(test_result_path_root)
...@@ -625,7 +625,7 @@ branch = foo ...@@ -625,7 +625,7 @@ branch = foo
self.assertEquals(1, len([x for x in suite_log.readlines() \ self.assertEquals(1, len([x for x in suite_log.readlines() \
if x.find("Activated logfile")>=0])) if x.find("Activated logfile")>=0]))
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
original_sleep = time.sleep original_sleep = time.sleep
time.sleep = doNothing time.sleep = doNothing
self.generateTestRepositoryList() self.generateTestRepositoryList()
...@@ -656,7 +656,7 @@ branch = foo ...@@ -656,7 +656,7 @@ branch = foo
RunnerClass._prepareSlapOS = original_prepareSlapOS RunnerClass._prepareSlapOS = original_prepareSlapOS
RunnerClass.runTestSuite = original_runTestSuite RunnerClass.runTestSuite = original_runTestSuite
def test_16_cleanupLogDirectory(self, my_type_test='UnitTest'): def test_16_cleanupLogDirectory(self, my_test_type='UnitTest'):
# Make sure that we are able to cleanup old log folders # Make sure that we are able to cleanup old log folders
test_node = self.getTestNode() test_node = self.getTestNode()
def check(file_list): def check(file_list):
...@@ -677,7 +677,7 @@ branch = foo ...@@ -677,7 +677,7 @@ branch = foo
test_node._cleanupLog() test_node._cleanupLog()
check(set(['a_file'])) check(set(['a_file']))
def test_17_cleanupTempDirectory(self, my_type_test='UnitTest'): def test_17_cleanupTempDirectory(self, my_test_type='UnitTest'):
# Make sure that we are able to cleanup old temp folders # Make sure that we are able to cleanup old temp folders
test_node = self.getTestNode() test_node = self.getTestNode()
temp_directory = self.system_temp_folder temp_directory = self.system_temp_folder
...@@ -699,7 +699,7 @@ branch = foo ...@@ -699,7 +699,7 @@ branch = foo
test_node._cleanupTemporaryFiles() test_node._cleanupTemporaryFiles()
check(set(['something'])) check(set(['something']))
def test_18_resetSoftwareAfterManyBuildFailures(self, my_type_test='UnitTest'): def test_18_resetSoftwareAfterManyBuildFailures(self, my_test_type='UnitTest'):
""" """
Check that after several building failures that the software is resetted Check that after several building failures that the software is resetted
""" """
...@@ -707,7 +707,7 @@ branch = foo ...@@ -707,7 +707,7 @@ branch = foo
SlapOSControler.initializeSlapOSControler SlapOSControler.initializeSlapOSControler
initial_runSoftwareRelease = SlapOSControler.runSoftwareRelease initial_runSoftwareRelease = SlapOSControler.runSoftwareRelease
test_node = self.getTestNode() test_node = self.getTestNode()
RunnerClass = self.returnGoodClassRunner(my_type_test) RunnerClass = self.returnGoodClassRunner(my_test_type)
runner = RunnerClass(test_node) runner = RunnerClass(test_node)
node_test_suite = test_node.getNodeTestSuite('foo') node_test_suite = test_node.getNodeTestSuite('foo')
init_call_kw_list = [] init_call_kw_list = []
...@@ -739,47 +739,47 @@ branch = foo ...@@ -739,47 +739,47 @@ branch = foo
initial_initializeSlapOSControler initial_initializeSlapOSControler
SlapOSControler.runSoftwareRelease = initial_runSoftwareRelease SlapOSControler.runSoftwareRelease = initial_runSoftwareRelease
def test_scalability_01_getDelNodeTestSuite(self, my_type_test='ScalabilityTest'): def test_scalability_01_getDelNodeTestSuite(self, my_test_type='ScalabilityTest'):
self.test_01_getDelNodeTestSuite(my_type_test) self.test_01_getDelNodeTestSuite(my_test_type)
def test_scalability_02_NodeTestSuiteWorkingDirectory(self, my_type_test='ScalabilityTest'): def test_scalability_02_NodeTestSuiteWorkingDirectory(self, my_test_type='ScalabilityTest'):
self.test_02_NodeTestSuiteWorkingDirectory(my_type_test) self.test_02_NodeTestSuiteWorkingDirectory(my_test_type)
def test_scalability_03_NodeTestSuiteCheckDataAfterEdit(self, my_type_test='ScalabilityTest'): def test_scalability_03_NodeTestSuiteCheckDataAfterEdit(self, my_test_type='ScalabilityTest'):
self.test_03_NodeTestSuiteCheckDataAfterEdit(my_type_test) self.test_03_NodeTestSuiteCheckDataAfterEdit(my_test_type)
def test_scalability_04_constructProfile(self, my_type_test='ScalabilityTest'): def test_scalability_04_constructProfile(self, my_test_type='ScalabilityTest'):
self.test_04_constructProfile(my_type_test) self.test_04_constructProfile(my_test_type)
def test_scalability_05_getAndUpdateFullRevisionList(self, my_type_test='ScalabilityTest'): def test_scalability_05_getAndUpdateFullRevisionList(self, my_test_type='ScalabilityTest'):
self.test_05_getAndUpdateFullRevisionList(my_type_test) self.test_05_getAndUpdateFullRevisionList(my_test_type)
def test_scalability_05b_changeRepositoryBranch(self, my_type_test='ScalabilityTest'): def test_scalability_05b_changeRepositoryBranch(self, my_test_type='ScalabilityTest'):
self.test_05b_changeRepositoryBranch(my_type_test) self.test_05b_changeRepositoryBranch(my_test_type)
def test_scalability_06_checkRevision(self, my_type_test='ScalabilityTest'): def test_scalability_06_checkRevision(self, my_test_type='ScalabilityTest'):
self.test_06_checkRevision(my_type_test) self.test_06_checkRevision(my_test_type)
def test_scalability_07_checkExistingTestSuite(self, my_type_test='ScalabilityTest'): def test_scalability_07_checkExistingTestSuite(self, my_test_type='ScalabilityTest'):
self.test_07_checkExistingTestSuite(my_type_test) self.test_07_checkExistingTestSuite(my_test_type)
def test_scalability_08_getSupportedParamaterSet(self, my_type_test='ScalabilityTest'): def test_scalability_08_getSupportedParamaterSet(self, my_test_type='ScalabilityTest'):
self.test_08_getSupportedParamaterSet(my_type_test) self.test_08_getSupportedParamaterSet(my_test_type)
def test_scalability_09_runTestSuite(self, my_type_test='ScalabilityTest'): def test_scalability_09_runTestSuite(self, my_test_type='ScalabilityTest'):
# TODO : write own scalability test # TODO : write own scalability test
pass pass
def test_scalability_10_prepareSlapOS(self, my_type_test='ScalabilityTest'): def test_scalability_10_prepareSlapOS(self, my_test_type='ScalabilityTest'):
# TODO : write own scalability test # TODO : write own scalability test
# This case test may be dispensable on ScalabilityTest case # This case test may be dispensable on ScalabilityTest case
# so.. # so..
pass pass
def test_scalability_11_run(self, my_type_test='ScalabilityTest'): def test_scalability_11_run(self, my_test_type='ScalabilityTest'):
self.test_11_run(my_type_test) self.test_11_run(my_test_type)
def test_scalability_12_spawn(self, my_type_test='ScalabilityTest'): def test_scalability_12_spawn(self, my_test_type='ScalabilityTest'):
self.test_12_spawn(my_type_test) self.test_12_spawn(my_test_type)
def test_scalability_13_SlaposControlerResetSoftware(self, my_type_test='ScalabilityTest'): def test_scalability_13_SlaposControlerResetSoftware(self, my_test_type='ScalabilityTest'):
self.test_13_SlaposControlerResetSoftware(my_type_test) self.test_13_SlaposControlerResetSoftware(my_test_type)
def test_scalability_14_createFolder(self, my_type_test='ScalabilityTest'): def test_scalability_14_createFolder(self, my_test_type='ScalabilityTest'):
self.test_14_createFolder(my_type_test) self.test_14_createFolder(my_test_type)
def test_scalability_15_suite_log_directory(self, my_type_test='ScalabilityTest'): def test_scalability_15_suite_log_directory(self, my_test_type='ScalabilityTest'):
self.test_15_suite_log_directory(my_type_test) self.test_15_suite_log_directory(my_test_type)
def test_scalability_16_cleanupLogDirectory(self, my_type_test='ScalabilityTest'): def test_scalability_16_cleanupLogDirectory(self, my_test_type='ScalabilityTest'):
self.test_16_cleanupLogDirectory(my_type_test) self.test_16_cleanupLogDirectory(my_test_type)
def test_scalability_17_cleanupTempDirectory(self, my_type_test='ScalabilityTest'): def test_scalability_17_cleanupTempDirectory(self, my_test_type='ScalabilityTest'):
self.test_17_cleanupTempDirectory(my_type_test) self.test_17_cleanupTempDirectory(my_test_type)
def test_scalability_18_resetSoftwareAfterManyBuildFailures(self, my_type_test='ScalabilityTest'): def test_scalability_18_resetSoftwareAfterManyBuildFailures(self, my_test_type='ScalabilityTest'):
# TODO : write own scalability test # TODO : write own scalability test
pass pass
#TODO : add more test for scalability case #TODO : add more test for scalability case
...@@ -342,25 +342,25 @@ branch = %(branch)s ...@@ -342,25 +342,25 @@ branch = %(branch)s
# into nexedi/master-erp5.. # into nexedi/master-erp5..
# (just UnitTestDistributor should be sufficient) # (just UnitTestDistributor should be sufficient)
try: try:
my_type_test = test_suite_portal.getTestType() my_test_type = test_suite_portal.getTestType()
except: except:
log("testnode, error during requesting getTestType() method \ log("testnode, error during requesting getTestType() method \
from the distributor.") from the distributor.")
raise NotImplementedError raise NotImplementedError
# Select runner according to the test type # Select runner according to the test type
if my_type_test == 'UnitTest': if my_test_type == 'UnitTest':
runner = UnitTestRunner(self) runner = UnitTestRunner(self)
elif my_type_test == 'ScalabilityTest': elif my_test_type == 'ScalabilityTest':
runner = ScalabilityTestRunner(self) runner = ScalabilityTestRunner(self)
else: else:
log("testnode, Runner type not implemented.", my_type_test) log("testnode, Runner type not implemented.", my_test_type)
raise NotImplementedError raise NotImplementedError
log("Type of current test is %s" %(my_type_test,)) log("Type of current test is %s" %(my_test_type,))
# master gets test_suites, slaves get nothing # master gets test_suites, slaves get nothing
if (len(test_suite_data) > 1) or (my_type_test == 'UnitTest'): if (len(test_suite_data) > 1) or (my_test_type == 'UnitTest'):
runner.prepareSlapOSForTestNode(test_node_slapos) runner.prepareSlapOSForTestNode(test_node_slapos)
#Clean-up test suites #Clean-up test suites
self.checkOldTestSuite(test_suite_data) self.checkOldTestSuite(test_suite_data)
......
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