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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
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
Show 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):
self
.
remote_repository0
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep0'
)
self
.
remote_repository1
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep1'
)
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'
)
os
.
mkdir
(
self
.
working_directory
)
os
.
mkdir
(
self
.
slapos_directory
)
...
...
@@ -89,7 +90,8 @@ class ERP5TestNode(TestCase):
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
=
[{
"test_suite"
:
"Foo"
,
"project_title"
:
reference
,
...
...
@@ -110,15 +112,22 @@ class ERP5TestNode(TestCase):
{
'url'
:
self
.
remote_repository2
,
'buildout_section_id'
:
'rep2'
,
'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
def
updateNodeTestSuiteData
(
self
,
node_test_suite
,
add_third_repository
=
False
):
add_third_repository
=
False
,
add_broken_repository
=
False
):
"""
Update from zero/Regenerate the testsuite
"""
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
):
class
Caller
(
object
):
...
...
@@ -360,7 +369,7 @@ develop = false
finally
:
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
git or any manual operation.
...
...
@@ -389,6 +398,19 @@ develop = false
self
.
assertEqual
(
"initial_content0"
,
my_file
.
read
())
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
):
"""
Check if we are able to restore older commit hash if master decide so
...
...
erp5/util/testnode/testnode.py
View file @
f7319ec9
...
...
@@ -189,6 +189,7 @@ develop = false
full_revision_list
=
[]
config
=
self
.
config
log
=
self
.
log
try
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
repository_path
=
vcs_repository
[
'repository_path'
]
repository_id
=
vcs_repository
[
'repository_id'
]
...
...
@@ -202,6 +203,9 @@ develop = false
revision
=
"-"
.
join
(
updater
.
getRevision
())
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
def
registerSuiteLog
(
self
,
test_result
,
node_test_suite
):
...
...
@@ -379,7 +383,9 @@ from the distributor.")
run_software
=
True
# kill processes from previous loop if any
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
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
runner
.
getRelativePathUsage
())
...
...
@@ -432,7 +438,7 @@ from the distributor.")
break
self
.
cleanUp
(
test_result
)
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
:
status_dict
=
e
.
status_dict
or
{}
test_result
.
reportFailure
(
...
...
@@ -443,7 +449,7 @@ from the distributor.")
continue
except
ValueError
as
e
:
# 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
:
node_test_suite
.
retry_software_count
+=
1
if
remote_test_result_needs_cleanup
:
...
...
@@ -467,8 +473,8 @@ from the distributor.")
sleep_time
=
120
-
(
now
-
begin
)
log
(
"End of processing, going to sleep %s"
%
sleep_time
)
time
.
sleep
(
sleep_time
)
except
:
log
(
"Exception in error handling
"
,
exc_info
=
sys
.
exc_info
())
except
Exception
as
e
:
log
(
"Exception in error handling
: %r"
%
(
e
,)
,
exc_info
=
sys
.
exc_info
())
finally
:
if
'tb'
in
locals
():
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