Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
erp5
Commits
f9b08acc
Commit
f9b08acc
authored
Jun 11, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo (definitively : my_test_type)
parent
366b0144
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
68 deletions
+68
-68
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+62
-62
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+6
-6
No files found.
erp5/tests/testERP5TestNode.py
View file @
f9b08acc
...
...
@@ -157,7 +157,7 @@ class ERP5TestNode(TestCase):
# ['4f1d14de1b04b4f878a442ee859791fa337bcf85', 'first_commit']]}
return
commit_dict
def
test_01_getDelNodeTestSuite
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_01_getDelNodeTestSuite
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
We should be able to get/delete NodeTestSuite objects inside test_node
"""
...
...
@@ -170,7 +170,7 @@ class ERP5TestNode(TestCase):
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
assertEquals
(
0
,
node_test_suite
.
retry_software_count
)
def
test_02_NodeTestSuiteWorkingDirectory
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_02_NodeTestSuiteWorkingDirectory
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Make sure we extend the working path with the node_test_suite reference
"""
...
...
@@ -182,7 +182,7 @@ class ERP5TestNode(TestCase):
self
.
assertEquals
(
"%s/foo/test_suite"
%
self
.
working_directory
,
node_test_suite
.
test_suite_directory
)
def
test_03_NodeTestSuiteCheckDataAfterEdit
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_03_NodeTestSuiteCheckDataAfterEdit
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
When a NodeTestSuite instance is edited, the method _checkData
analyse properties and add new ones
...
...
@@ -198,7 +198,7 @@ class ERP5TestNode(TestCase):
"%s/rep1"
%
node_test_suite
.
working_directory
]
self
.
assertEquals
(
expected_list
,
repository_path_list
)
def
test_04_constructProfile
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_04_constructProfile
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Check if the software profile is correctly generated
"""
...
...
@@ -224,7 +224,7 @@ branch = foo
self
.
assertEquals
(
expected_profile
,
profile
.
read
())
profile
.
close
()
def
test_05_getAndUpdateFullRevisionList
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_05_getAndUpdateFullRevisionList
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Check if we clone correctly repositories and get right revisions
"""
...
...
@@ -248,7 +248,7 @@ branch = foo
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
self
.
assertTrue
(
os
.
path
.
exists
(
vcs_repository
[
'repository_path'
]))
def
test_05b_changeRepositoryBranch
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_05b_changeRepositoryBranch
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
It could happen that the branch is changed for a repository. Testnode must
be able to reset correctly the branch
...
...
@@ -283,7 +283,7 @@ branch = foo
output
=
call
(
"git branch"
.
split
()).
strip
()
self
.
assertTrue
(
"* bar"
in
output
.
split
(
'
\
n
'
))
def
test_06_checkRevision
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_06_checkRevision
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Check if we are able to restore older commit hash if master decide so
"""
...
...
@@ -320,7 +320,7 @@ branch = foo
self
.
assertEquals
([
commit_dict
[
'rep0'
][
0
][
0
],
commit_dict
[
'rep1'
][
1
][
0
]],
getRepInfo
(
hash
=
1
))
def
test_07_checkExistingTestSuite
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_07_checkExistingTestSuite
(
self
,
my_t
est_type
=
'UnitTest'
):
test_node
=
self
.
getTestNode
()
test_suite_data
=
self
.
getTestSuiteData
(
add_third_repository
=
True
)
self
.
assertEquals
([],
os
.
listdir
(
self
.
working_directory
))
...
...
@@ -336,7 +336,7 @@ branch = foo
test_node
.
checkOldTestSuite
(
test_suite_data
)
self
.
assertEquals
([
'foo'
],
os
.
listdir
(
self
.
working_directory
))
def
test_08_getSupportedParamaterSet
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_08_getSupportedParamaterSet
(
self
,
my_t
est_type
=
'UnitTest'
):
original_spawn
=
ProcessManager
.
spawn
try
:
def
get_help
(
self
,
*
args
,
**
kw
):
...
...
@@ -353,7 +353,7 @@ branch = foo
finally
:
ProcessManager
.
spawn
=
original_spawn
def
test_09_runTestSuite
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_09_runTestSuite
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Check parameters passed to runTestSuite
Also make sure that --firefox_bin and --xvfb_bin are passed when needed
...
...
@@ -377,7 +377,7 @@ branch = foo
return
[]
test_node
=
self
.
getTestNode
()
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
runner
=
RunnerClass
(
test_node
)
# Create and initialise/regenerate a nodetestsuite
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
...
...
@@ -390,7 +390,7 @@ branch = foo
def
checkRunTestSuiteParameters
(
additional_parameter_list
=
None
):
ProcessManager
.
getSupportedParameterSet
=
patch_getSupportedParameterSet
ProcessManager
.
spawn
=
get_parameters
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
runner
=
RunnerClass
(
test_node
)
runner
.
runTestSuite
(
node_test_suite
,
"http://foo.bar"
)
expected_parameter_list
=
[
'%s/a/bin/runTestSuite'
...
...
@@ -416,10 +416,10 @@ branch = foo
ProcessManager
.
getSupportedParameterSet
=
original_getSupportedParameter
ProcessManager
.
spawn
=
original_spawn
def
test_10_prepareSlapOS
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_10_prepareSlapOS
(
self
,
my_t
est_type
=
'UnitTest'
):
test_node
=
self
.
getTestNode
()
test_node_slapos
=
SlapOSInstance
()
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
runner
=
RunnerClass
(
test_node
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
.
edit
(
working_directory
=
self
.
working_directory
)
...
...
@@ -457,11 +457,11 @@ branch = foo
self
.
assertRaises
(
SubprocessError
,
runner
.
prepareSlapOSForTestSuite
,
node_test_suite
)
def
test_11_run
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_11_run
(
self
,
my_t
est_type
=
'UnitTest'
):
def
doNothing
(
self
,
*
args
,
**
kw
):
pass
def
patch_getTestType
(
self
):
return
my_t
ype_test
return
my_t
est_type
test_self
=
self
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
os
.
makedirs
(
test_result_path_root
)
...
...
@@ -512,7 +512,7 @@ branch = foo
original_sleep
=
time
.
sleep
time
.
sleep
=
doNothing
self
.
generateTestRepositoryList
()
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
# Patch
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
...
...
@@ -542,7 +542,7 @@ branch = foo
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
def
test_12_spawn
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_12_spawn
(
self
,
my_t
est_type
=
'UnitTest'
):
def
_checkCorrectStatus
(
expected_status
,
*
args
):
result
=
process_manager
.
spawn
(
*
args
)
self
.
assertEqual
(
result
[
'status_code'
],
expected_status
)
...
...
@@ -552,7 +552,7 @@ branch = foo
# it will be automatically killed
self
.
assertRaises
(
SubprocessError
,
process_manager
.
spawn
,
'sleep'
,
'3'
)
def
test_13_SlaposControlerResetSoftware
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_13_SlaposControlerResetSoftware
(
self
,
my_t
est_type
=
'UnitTest'
):
test_node
=
self
.
getTestNode
()
controler
=
SlapOSControler
(
self
.
working_directory
,
test_node
.
config
,
self
.
log
)
...
...
@@ -564,7 +564,7 @@ branch = foo
controler
.
_resetSoftware
()
self
.
assertEquals
([],
os
.
listdir
(
controler
.
software_root
))
def
test_14_createFolder
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_14_createFolder
(
self
,
my_t
est_type
=
'UnitTest'
):
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
.
edit
(
working_directory
=
self
.
working_directory
)
...
...
@@ -579,11 +579,11 @@ branch = foo
createFolder
(
folder
,
clean
=
True
)
self
.
assertEquals
(
False
,
os
.
path
.
exists
(
to_drop_path
))
def
test_15_suite_log_directory
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_15_suite_log_directory
(
self
,
my_t
est_type
=
'UnitTest'
):
def
doNothing
(
self
,
*
args
,
**
kw
):
pass
def
patch_getTestType
(
self
):
return
my_t
ype_test
return
my_t
est_type
test_self
=
self
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
os
.
makedirs
(
test_result_path_root
)
...
...
@@ -625,7 +625,7 @@ branch = foo
self
.
assertEquals
(
1
,
len
([
x
for
x
in
suite_log
.
readlines
()
\
if
x
.
find
(
"Activated logfile"
)
>=
0
]))
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
original_sleep
=
time
.
sleep
time
.
sleep
=
doNothing
self
.
generateTestRepositoryList
()
...
...
@@ -656,7 +656,7 @@ branch = foo
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
def
test_16_cleanupLogDirectory
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_16_cleanupLogDirectory
(
self
,
my_t
est_type
=
'UnitTest'
):
# Make sure that we are able to cleanup old log folders
test_node
=
self
.
getTestNode
()
def
check
(
file_list
):
...
...
@@ -677,7 +677,7 @@ branch = foo
test_node
.
_cleanupLog
()
check
(
set
([
'a_file'
]))
def
test_17_cleanupTempDirectory
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_17_cleanupTempDirectory
(
self
,
my_t
est_type
=
'UnitTest'
):
# Make sure that we are able to cleanup old temp folders
test_node
=
self
.
getTestNode
()
temp_directory
=
self
.
system_temp_folder
...
...
@@ -699,7 +699,7 @@ branch = foo
test_node
.
_cleanupTemporaryFiles
()
check
(
set
([
'something'
]))
def
test_18_resetSoftwareAfterManyBuildFailures
(
self
,
my_t
ype_test
=
'UnitTest'
):
def
test_18_resetSoftwareAfterManyBuildFailures
(
self
,
my_t
est_type
=
'UnitTest'
):
"""
Check that after several building failures that the software is resetted
"""
...
...
@@ -707,7 +707,7 @@ branch = foo
SlapOSControler
.
initializeSlapOSControler
initial_runSoftwareRelease
=
SlapOSControler
.
runSoftwareRelease
test_node
=
self
.
getTestNode
()
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
ype_test
)
RunnerClass
=
self
.
returnGoodClassRunner
(
my_t
est_type
)
runner
=
RunnerClass
(
test_node
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
init_call_kw_list
=
[]
...
...
@@ -739,47 +739,47 @@ branch = foo
initial_initializeSlapOSControler
SlapOSControler
.
runSoftwareRelease
=
initial_runSoftwareRelease
def
test_scalability_01_getDelNodeTestSuite
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_01_getDelNodeTestSuite
(
my_t
ype_test
)
def
test_scalability_02_NodeTestSuiteWorkingDirectory
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_02_NodeTestSuiteWorkingDirectory
(
my_t
ype_test
)
def
test_scalability_03_NodeTestSuiteCheckDataAfterEdit
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_03_NodeTestSuiteCheckDataAfterEdit
(
my_t
ype_test
)
def
test_scalability_04_constructProfile
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_04_constructProfile
(
my_t
ype_test
)
def
test_scalability_05_getAndUpdateFullRevisionList
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_05_getAndUpdateFullRevisionList
(
my_t
ype_test
)
def
test_scalability_05b_changeRepositoryBranch
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_05b_changeRepositoryBranch
(
my_t
ype_test
)
def
test_scalability_06_checkRevision
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_06_checkRevision
(
my_t
ype_test
)
def
test_scalability_07_checkExistingTestSuite
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_07_checkExistingTestSuite
(
my_t
ype_test
)
def
test_scalability_08_getSupportedParamaterSet
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_08_getSupportedParamaterSet
(
my_t
ype_test
)
def
test_scalability_09_runTestSuite
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
def
test_scalability_01_getDelNodeTestSuite
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_01_getDelNodeTestSuite
(
my_t
est_type
)
def
test_scalability_02_NodeTestSuiteWorkingDirectory
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_02_NodeTestSuiteWorkingDirectory
(
my_t
est_type
)
def
test_scalability_03_NodeTestSuiteCheckDataAfterEdit
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_03_NodeTestSuiteCheckDataAfterEdit
(
my_t
est_type
)
def
test_scalability_04_constructProfile
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_04_constructProfile
(
my_t
est_type
)
def
test_scalability_05_getAndUpdateFullRevisionList
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_05_getAndUpdateFullRevisionList
(
my_t
est_type
)
def
test_scalability_05b_changeRepositoryBranch
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_05b_changeRepositoryBranch
(
my_t
est_type
)
def
test_scalability_06_checkRevision
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_06_checkRevision
(
my_t
est_type
)
def
test_scalability_07_checkExistingTestSuite
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_07_checkExistingTestSuite
(
my_t
est_type
)
def
test_scalability_08_getSupportedParamaterSet
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_08_getSupportedParamaterSet
(
my_t
est_type
)
def
test_scalability_09_runTestSuite
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
# TODO : write own scalability test
pass
def
test_scalability_10_prepareSlapOS
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
def
test_scalability_10_prepareSlapOS
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
# TODO : write own scalability test
# This case test may be dispensable on ScalabilityTest case
# so..
pass
def
test_scalability_11_run
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_11_run
(
my_t
ype_test
)
def
test_scalability_12_spawn
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_12_spawn
(
my_t
ype_test
)
def
test_scalability_13_SlaposControlerResetSoftware
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_13_SlaposControlerResetSoftware
(
my_t
ype_test
)
def
test_scalability_14_createFolder
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_14_createFolder
(
my_t
ype_test
)
def
test_scalability_15_suite_log_directory
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_15_suite_log_directory
(
my_t
ype_test
)
def
test_scalability_16_cleanupLogDirectory
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_16_cleanupLogDirectory
(
my_t
ype_test
)
def
test_scalability_17_cleanupTempDirectory
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
self
.
test_17_cleanupTempDirectory
(
my_t
ype_test
)
def
test_scalability_18_resetSoftwareAfterManyBuildFailures
(
self
,
my_t
ype_test
=
'ScalabilityTest'
):
def
test_scalability_11_run
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_11_run
(
my_t
est_type
)
def
test_scalability_12_spawn
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_12_spawn
(
my_t
est_type
)
def
test_scalability_13_SlaposControlerResetSoftware
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_13_SlaposControlerResetSoftware
(
my_t
est_type
)
def
test_scalability_14_createFolder
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_14_createFolder
(
my_t
est_type
)
def
test_scalability_15_suite_log_directory
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_15_suite_log_directory
(
my_t
est_type
)
def
test_scalability_16_cleanupLogDirectory
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_16_cleanupLogDirectory
(
my_t
est_type
)
def
test_scalability_17_cleanupTempDirectory
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
self
.
test_17_cleanupTempDirectory
(
my_t
est_type
)
def
test_scalability_18_resetSoftwareAfterManyBuildFailures
(
self
,
my_t
est_type
=
'ScalabilityTest'
):
# TODO : write own scalability test
pass
#TODO : add more test for scalability case
erp5/util/testnode/testnode.py
View file @
f9b08acc
...
...
@@ -342,25 +342,25 @@ branch = %(branch)s
# into nexedi/master-erp5..
# (just UnitTestDistributor should be sufficient)
try
:
my_t
ype_test
=
test_suite_portal
.
getTestType
()
my_t
est_type
=
test_suite_portal
.
getTestType
()
except
:
log
(
"testnode, error during requesting getTestType() method
\
from the distributor."
)
raise
NotImplementedError
# Select runner according to the test type
if
my_t
ype_test
==
'UnitTest'
:
if
my_t
est_type
==
'UnitTest'
:
runner
=
UnitTestRunner
(
self
)
elif
my_t
ype_test
==
'ScalabilityTest'
:
elif
my_t
est_type
==
'ScalabilityTest'
:
runner
=
ScalabilityTestRunner
(
self
)
else
:
log
(
"testnode, Runner type not implemented."
,
my_t
ype_test
)
log
(
"testnode, Runner type not implemented."
,
my_t
est_type
)
raise
NotImplementedError
log
(
"Type of current test is %s"
%
(
my_t
ype_test
,))
log
(
"Type of current test is %s"
%
(
my_t
est_type
,))
# master gets test_suites, slaves get nothing
if
(
len
(
test_suite_data
)
>
1
)
or
(
my_t
ype_test
==
'UnitTest'
):
if
(
len
(
test_suite_data
)
>
1
)
or
(
my_t
est_type
==
'UnitTest'
):
runner
.
prepareSlapOSForTestNode
(
test_node_slapos
)
#Clean-up test suites
self
.
checkOldTestSuite
(
test_suite_data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment