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
0
Issues
0
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
Mikolaï Krol
erp5
Commits
f7319ec9
Commit
f7319ec9
authored
Aug 02, 2016
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5.util.testnode: do not block all test suites if one of them define broken repository
parent
b56e3520
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
22 deletions
+50
-22
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+26
-4
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+24
-18
No files found.
erp5/tests/testERP5TestNode.py
View file @
f7319ec9
...
@@ -38,6 +38,7 @@ class ERP5TestNode(TestCase):
...
@@ -38,6 +38,7 @@ class ERP5TestNode(TestCase):
self
.
remote_repository0
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep0'
)
self
.
remote_repository0
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep0'
)
self
.
remote_repository1
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep1'
)
self
.
remote_repository1
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep1'
)
self
.
remote_repository2
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep2'
)
self
.
remote_repository2
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep2'
)
self
.
remote_repository_broken
=
os
.
path
.
join
(
self
.
_temp_dir
,
'broken'
)
self
.
system_temp_folder
=
os
.
path
.
join
(
self
.
_temp_dir
,
'tmp'
)
self
.
system_temp_folder
=
os
.
path
.
join
(
self
.
_temp_dir
,
'tmp'
)
os
.
mkdir
(
self
.
working_directory
)
os
.
mkdir
(
self
.
working_directory
)
os
.
mkdir
(
self
.
slapos_directory
)
os
.
mkdir
(
self
.
slapos_directory
)
...
@@ -89,7 +90,8 @@ class ERP5TestNode(TestCase):
...
@@ -89,7 +90,8 @@ class ERP5TestNode(TestCase):
return
TestNode
(
self
.
log
,
config
)
return
TestNode
(
self
.
log
,
config
)
def
getTestSuiteData
(
self
,
add_third_repository
=
False
,
reference
=
"foo"
):
def
getTestSuiteData
(
self
,
add_third_repository
=
False
,
add_broken_repository
=
False
,
reference
=
"foo"
):
data
=
[{
data
=
[{
"test_suite"
:
"Foo"
,
"test_suite"
:
"Foo"
,
"project_title"
:
reference
,
"project_title"
:
reference
,
...
@@ -110,15 +112,22 @@ class ERP5TestNode(TestCase):
...
@@ -110,15 +112,22 @@ class ERP5TestNode(TestCase):
{
'url'
:
self
.
remote_repository2
,
{
'url'
:
self
.
remote_repository2
,
'buildout_section_id'
:
'rep2'
,
'buildout_section_id'
:
'rep2'
,
'branch'
:
'foo'
})
'branch'
:
'foo'
})
if
add_broken_repository
:
data
[
0
][
'vcs_repository_list'
].
append
(
{
'url'
:
self
.
remote_repository_broken
,
'buildout_section_id'
:
'rep2'
,
'branch'
:
'foo'
})
return
data
return
data
def
updateNodeTestSuiteData
(
self
,
node_test_suite
,
def
updateNodeTestSuiteData
(
self
,
node_test_suite
,
add_third_repository
=
False
):
add_third_repository
=
False
,
add_broken_repository
=
False
):
"""
"""
Update from zero/Regenerate the testsuite
Update from zero/Regenerate the testsuite
"""
"""
node_test_suite
.
edit
(
working_directory
=
self
.
working_directory
,
node_test_suite
.
edit
(
working_directory
=
self
.
working_directory
,
**
self
.
getTestSuiteData
(
add_third_repository
=
add_third_repository
)[
0
])
**
self
.
getTestSuiteData
(
add_third_repository
=
add_third_repository
,
add_broken_repository
=
add_broken_repository
)[
0
])
def
getCaller
(
self
,
**
kw
):
def
getCaller
(
self
,
**
kw
):
class
Caller
(
object
):
class
Caller
(
object
):
...
@@ -360,7 +369,7 @@ develop = false
...
@@ -360,7 +369,7 @@ develop = false
finally
:
finally
:
Updater
.
deleteRepository
=
original_deleteRepository
Updater
.
deleteRepository
=
original_deleteRepository
def
test_05d_LocalModifcationOnRepository
(
self
):
def
test_05d_LocalModif
i
cationOnRepository
(
self
):
"""
"""
It could happen that there is local modification to to either bug of
It could happen that there is local modification to to either bug of
git or any manual operation.
git or any manual operation.
...
@@ -389,6 +398,19 @@ develop = false
...
@@ -389,6 +398,19 @@ develop = false
self
.
assertEqual
(
"initial_content0"
,
my_file
.
read
())
self
.
assertEqual
(
"initial_content0"
,
my_file
.
read
())
my_file
.
close
()
my_file
.
close
()
def
test_05e_IgnoringIncorrectRepository
(
self
):
"""
If someone add a test suite with a bad url for git repository (or wrong
crendentials), the testnode should not block forever and should work on
other test suites. This method should be able to run
"""
commit_dict
=
self
.
generateTestRepositoryList
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_broken_repository
=
True
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
self
.
assertEqual
(
None
,
rev_list
)
def
test_06_checkRevision
(
self
):
def
test_06_checkRevision
(
self
):
"""
"""
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
...
...
erp5/util/testnode/testnode.py
View file @
f7319ec9
...
@@ -189,19 +189,23 @@ develop = false
...
@@ -189,19 +189,23 @@ develop = false
full_revision_list
=
[]
full_revision_list
=
[]
config
=
self
.
config
config
=
self
.
config
log
=
self
.
log
log
=
self
.
log
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
try
:
repository_path
=
vcs_repository
[
'repository_path'
]
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
repository_id
=
vcs_repository
[
'repository_id'
]
repository_path
=
vcs_repository
[
'repository_path'
]
branch
=
vcs_repository
.
get
(
'branch'
)
repository_id
=
vcs_repository
[
'repository_id'
]
# Make sure we have local repository
branch
=
vcs_repository
.
get
(
'branch'
)
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
# Make sure we have local repository
branch
=
branch
,
log
=
log
,
process_manager
=
self
.
process_manager
,
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
working_directory
=
node_test_suite
.
working_directory
,
branch
=
branch
,
log
=
log
,
process_manager
=
self
.
process_manager
,
url
=
vcs_repository
[
"url"
])
working_directory
=
node_test_suite
.
working_directory
,
updater
.
checkout
()
url
=
vcs_repository
[
"url"
])
revision
=
"-"
.
join
(
updater
.
getRevision
())
updater
.
checkout
()
full_revision_list
.
append
(
'%s=%s'
%
(
repository_id
,
revision
))
revision
=
"-"
.
join
(
updater
.
getRevision
())
node_test_suite
.
revision
=
','
.
join
(
full_revision_list
)
full_revision_list
.
append
(
'%s=%s'
%
(
repository_id
,
revision
))
node_test_suite
.
revision
=
','
.
join
(
full_revision_list
)
except
SubprocessError
,
e
:
log
(
"Error while getting repository, ignoring this test suite : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
())
full_revision_list
=
None
return
full_revision_list
return
full_revision_list
def
registerSuiteLog
(
self
,
test_result
,
node_test_suite
):
def
registerSuiteLog
(
self
,
test_result
,
node_test_suite
):
...
@@ -379,7 +383,9 @@ from the distributor.")
...
@@ -379,7 +383,9 @@ from the distributor.")
run_software
=
True
run_software
=
True
# kill processes from previous loop if any
# kill processes from previous loop if any
self
.
process_manager
.
killPreviousRun
()
self
.
process_manager
.
killPreviousRun
()
self
.
getAndUpdateFullRevisionList
(
node_test_suite
)
revision_list
=
self
.
getAndUpdateFullRevisionList
(
node_test_suite
)
if
revision_list
is
None
:
continue
# Write our own software.cfg to use the local repository
# Write our own software.cfg to use the local repository
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
runner
.
getRelativePathUsage
())
runner
.
getRelativePathUsage
())
...
@@ -432,7 +438,7 @@ from the distributor.")
...
@@ -432,7 +438,7 @@ from the distributor.")
break
break
self
.
cleanUp
(
test_result
)
self
.
cleanUp
(
test_result
)
except
(
SubprocessError
,
CalledProcessError
,
RequestException
)
as
e
:
except
(
SubprocessError
,
CalledProcessError
,
RequestException
)
as
e
:
log
(
"SubprocessError or RequestException
"
,
exc_info
=
sys
.
exc_info
())
log
(
"SubprocessError or RequestException
: %r"
%
(
e
,)
,
exc_info
=
sys
.
exc_info
())
if
remote_test_result_needs_cleanup
:
if
remote_test_result_needs_cleanup
:
status_dict
=
e
.
status_dict
or
{}
status_dict
=
e
.
status_dict
or
{}
test_result
.
reportFailure
(
test_result
.
reportFailure
(
...
@@ -443,7 +449,7 @@ from the distributor.")
...
@@ -443,7 +449,7 @@ from the distributor.")
continue
continue
except
ValueError
as
e
:
except
ValueError
as
e
:
# This could at least happens if runTestSuite is not found
# This could at least happens if runTestSuite is not found
log
(
"ValueError
"
,
exc_info
=
sys
.
exc_info
())
log
(
"ValueError
: %r"
%
(
e
,)
,
exc_info
=
sys
.
exc_info
())
if
node_test_suite
is
not
None
:
if
node_test_suite
is
not
None
:
node_test_suite
.
retry_software_count
+=
1
node_test_suite
.
retry_software_count
+=
1
if
remote_test_result_needs_cleanup
:
if
remote_test_result_needs_cleanup
:
...
@@ -467,8 +473,8 @@ from the distributor.")
...
@@ -467,8 +473,8 @@ from the distributor.")
sleep_time
=
120
-
(
now
-
begin
)
sleep_time
=
120
-
(
now
-
begin
)
log
(
"End of processing, going to sleep %s"
%
sleep_time
)
log
(
"End of processing, going to sleep %s"
%
sleep_time
)
time
.
sleep
(
sleep_time
)
time
.
sleep
(
sleep_time
)
except
:
except
Exception
as
e
:
log
(
"Exception in error handling
"
,
exc_info
=
sys
.
exc_info
())
log
(
"Exception in error handling
: %r"
%
(
e
,)
,
exc_info
=
sys
.
exc_info
())
finally
:
finally
:
if
'tb'
in
locals
():
if
'tb'
in
locals
():
del
tb
del
tb
...
...
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