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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
b7681cd6
Commit
b7681cd6
authored
Nov 04, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5.util.testnode: clean up error handling in TestNode
parent
8a97b6c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+18
-22
No files found.
erp5/util/testnode/testnode.py
View file @
b7681cd6
...
@@ -195,7 +195,8 @@ shared = true
...
@@ -195,7 +195,8 @@ shared = true
updater
.
checkout
()
updater
.
checkout
()
revision_list
.
append
((
repository_id
,
updater
.
getRevision
()))
revision_list
.
append
((
repository_id
,
updater
.
getRevision
()))
except
SubprocessError
,
e
:
except
SubprocessError
,
e
:
log
(
"Error while getting repository, ignoring this test suite : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
())
log
(
"Error while getting repository, ignoring this test suite"
,
exc_info
=
1
)
return
False
return
False
node_test_suite
.
revision_list
=
revision_list
node_test_suite
.
revision_list
=
revision_list
return
True
return
True
...
@@ -288,7 +289,7 @@ shared = true
...
@@ -288,7 +289,7 @@ shared = true
else
:
else
:
os
.
remove
(
folder_path
)
os
.
remove
(
folder_path
)
except
OSError
:
except
OSError
:
self
.
log
(
"_cleanupTemporaryFiles exception"
,
exc_info
=
sys
.
exc_info
()
)
self
.
log
(
"_cleanupTemporaryFiles exception"
,
exc_info
=
1
)
def
cleanUp
(
self
,
test_result
):
def
cleanUp
(
self
,
test_result
):
log
=
self
.
log
log
=
self
.
log
...
@@ -330,13 +331,13 @@ shared = true
...
@@ -330,13 +331,13 @@ shared = true
# Backward compatiblity
# Backward compatiblity
test_suite_data
=
json
.
loads
(
test_suite_data
)
test_suite_data
=
json
.
loads
(
test_suite_data
)
test_suite_data
=
Utils
.
deunicodeData
(
test_suite_data
)
test_suite_data
=
Utils
.
deunicodeData
(
test_suite_data
)
log
(
"Got following test suite data from master : %r"
%
\
log
(
"Got following test suite data from master : %r"
,
(
test_suite_data
,)
)
test_suite_data
)
try
:
try
:
my_test_type
=
self
.
test_suite_portal
.
getTestType
()
my_test_type
=
self
.
test_suite_portal
.
getTestType
()
except
:
except
Exception
:
log
(
"testnode, error during requesting getTestType() method
\
log
(
"testnode, error during requesting getTestType() method
"
from the distributor."
)
"
from the distributor."
)
raise
raise
# Select runner according to the test type
# Select runner according to the test type
if
my_test_type
==
'UnitTest'
:
if
my_test_type
==
'UnitTest'
:
...
@@ -346,7 +347,7 @@ from the distributor.")
...
@@ -346,7 +347,7 @@ from the distributor.")
else
:
else
:
log
(
"testnode, Runner type %s not implemented."
,
my_test_type
)
log
(
"testnode, Runner type %s not implemented."
,
my_test_type
)
raise
NotImplementedError
raise
NotImplementedError
log
(
"Type of current test is %s"
%
(
my_test_type
,)
)
log
(
"Type of current test is %s"
,
my_test_type
)
# master testnode gets test_suites, slaves get nothing
# master testnode gets test_suites, slaves get nothing
runner
.
prepareSlapOSForTestNode
(
test_node_slapos
)
runner
.
prepareSlapOSForTestNode
(
test_node_slapos
)
# Clean-up test suites
# Clean-up test suites
...
@@ -386,7 +387,7 @@ from the distributor.")
...
@@ -386,7 +387,7 @@ from the distributor.")
node_test_suite
.
test_suite_title
,
node_test_suite
.
test_suite_title
,
node_test_suite
.
project_title
)
node_test_suite
.
project_title
)
remote_test_result_needs_cleanup
=
True
remote_test_result_needs_cleanup
=
True
log
(
"testnode, test_result : %r"
%
(
test_result
,
)
)
log
(
"testnode, test_result : %r"
,
test_result
)
if
test_result
is
not
None
:
if
test_result
is
not
None
:
self
.
registerSuiteLog
(
test_result
,
node_test_suite
)
self
.
registerSuiteLog
(
test_result
,
node_test_suite
)
self
.
checkRevision
(
test_result
,
node_test_suite
)
self
.
checkRevision
(
test_result
,
node_test_suite
)
...
@@ -424,12 +425,11 @@ from the distributor.")
...
@@ -424,12 +425,11 @@ from the distributor.")
raise
ValueError
(
error_message
)
raise
ValueError
(
error_message
)
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
# break the loop to get latest priorities from master
# break the loop to get latest priorities from master
break
break
self
.
cleanUp
(
test_result
)
self
.
cleanUp
(
test_result
)
except
(
SubprocessError
,
CalledProcessError
,
ConnectionError
)
as
e
:
except
(
SubprocessError
,
CalledProcessError
,
ConnectionError
)
as
e
:
log
(
"
SubprocessError or ConnectionError : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
()
)
log
(
"
"
,
exc_info
=
1
)
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
(
...
@@ -440,7 +440,7 @@ from the distributor.")
...
@@ -440,7 +440,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 : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
()
)
log
(
"
"
,
exc_info
=
1
)
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
:
...
@@ -448,24 +448,20 @@ from the distributor.")
...
@@ -448,24 +448,20 @@ from the distributor.")
command
=
''
,
stdout
=
''
,
command
=
''
,
stdout
=
''
,
stderr
=
"ValueError was raised : %s"
%
(
e
,),
stderr
=
"ValueError was raised : %s"
%
(
e
,),
)
)
except
CancellationError
,
e
:
except
CancellationError
:
log
(
"
CancellationError"
,
exc_info
=
sys
.
exc_info
()
)
log
(
"
"
,
exc_info
=
1
)
self
.
process_manager
.
under_cancellation
=
False
self
.
process_manager
.
under_cancellation
=
False
node_test_suite
.
retry
=
True
node_test_suite
.
retry
=
True
continue
continue
except
:
ex_type
,
ex
,
tb
=
sys
.
exc_info
()
traceback
.
print_tb
(
tb
)
log
(
"erp5testnode exception"
,
exc_info
=
sys
.
exc_info
())
raise
now
=
time
.
time
()
now
=
time
.
time
()
self
.
cleanUp
(
test_result
)
self
.
cleanUp
(
test_result
)
if
(
now
-
begin
)
<
120
:
if
(
now
-
begin
)
<
120
:
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
Exception
as
e
:
except
:
log
(
"Exception in error handling : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
())
log
(
""
,
exc_info
=
1
)
raise
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