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
alecs_myu
erp5
Commits
423cca27
Commit
423cca27
authored
Sep 05, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: update runTestSuite code according to recent chanements in taskdistribution
parent
cc7c8b13
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
62 deletions
+40
-62
erp5/util/taskdistribution/__init__.py
erp5/util/taskdistribution/__init__.py
+4
-23
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+36
-39
No files found.
erp5/util/taskdistribution/__init__.py
View file @
423cca27
...
@@ -138,33 +138,14 @@ class TestResultLineProxy(RPCRetry):
...
@@ -138,33 +138,14 @@ class TestResultLineProxy(RPCRetry):
def
name
(
self
):
def
name
(
self
):
return
self
.
_name
return
self
.
_name
def
is
Running
(
self
):
def
is
TestCaseAlive
(
self
):
"""
"""
Return : boolean
Tell if test result line is still alive on site.
"""
"""
try
:
try
:
return
bool
(
self
.
_retryRPC
(
'isTestCase
Running
'
,
[
self
.
_test_result_line_path
]))
return
bool
(
self
.
_retryRPC
(
'isTestCase
Alive
'
,
[
self
.
_test_result_line_path
]))
except
:
except
:
raise
ValueError
(
'isTestCaseRunning Failed.'
)
raise
ValueError
(
'isTestCaseAlive Failed.'
)
def
isFailed
(
self
):
"""
Return : boolean
"""
return
bool
(
self
.
_retryRPC
(
'isTestCaseFailed'
,
[
self
.
_test_result_line_path
]))
def
isCompleted
(
self
):
"""
Return : boolean
"""
return
bool
(
self
.
_retryRPC
(
'isTestCaseCompleted'
,
[
self
.
_test_result_line_path
]))
def
isCancelled
(
self
):
"""
Return : boolean
"""
return
bool
(
self
.
_retryRPC
(
'isTestCaseCancelled'
,
[
self
.
_test_result_line_path
]))
def
stop
(
self
,
test_count
=
None
,
error_count
=
None
,
failure_count
=
None
,
def
stop
(
self
,
test_count
=
None
,
error_count
=
None
,
failure_count
=
None
,
skip_count
=
None
,
duration
=
None
,
date
=
None
,
command
=
None
,
skip_count
=
None
,
duration
=
None
,
date
=
None
,
command
=
None
,
...
...
erp5/util/testnode/ScalabilityTestRunner.py
View file @
423cca27
...
@@ -50,6 +50,8 @@ import signal
...
@@ -50,6 +50,8 @@ import signal
MAX_INSTANCE_TIME
=
60
*
60
*
2
MAX_INSTANCE_TIME
=
60
*
60
*
2
# max time to register instance to slapOSMaster: 5 minutes
# max time to register instance to slapOSMaster: 5 minutes
MAX_CREATION_INSTANCE_TIME
=
60
*
10
MAX_CREATION_INSTANCE_TIME
=
60
*
10
# max time for a test: 1 hour
MAX_TEST_CASE_TIME
=
60
*
60
class
ScalabilityTestRunner
():
class
ScalabilityTestRunner
():
def
__init__
(
self
,
testnode
):
def
__init__
(
self
,
testnode
):
...
@@ -371,7 +373,12 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -371,7 +373,12 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
node_test_suite
.
project_title
)
node_test_suite
.
project_title
)
count
=
0
count
=
0
error
=
None
# Each cluster configuration are tested
for
configuration
in
configuration_list
:
for
configuration
in
configuration_list
:
# First configuration doesn't need XML configuration update.
if
count
>
0
:
if
count
>
0
:
# Stop instance
# Stop instance
self
.
slapos_controler
.
stopInstance
(
self
.
instance_title
)
self
.
slapos_controler
.
stopInstance
(
self
.
instance_title
)
...
@@ -397,69 +404,59 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -397,69 +404,59 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
exclude_list
=
[
x
for
x
in
test_list
if
x
!=
test_list
[
count
]]
exclude_list
=
[
x
for
x
in
test_list
if
x
!=
test_list
[
count
]]
count
+=
1
count
+=
1
test_result_line_proxy
=
test_result_proxy
.
start
(
exclude_list
)
test_result_line_proxy
=
test_result_proxy
.
start
(
exclude_list
)
#
if
test_result_line_proxy
==
None
:
if
test_result_line_proxy
==
None
:
#self.log("Already tested.")
error_message
=
"Test case already tested."
#error = ValueError("Test already tested.")
error
=
ValueError
(
error_message
)
self
.
log
(
"Warning::Test already tested."
)
break
break
;
# TODO: use only isAlive() and change test_result workflow on ERP5 Master side for the scalability case
self
.
log
(
"Test for count : %d is in a running state."
%
count
)
self
.
log
(
"Test for count : %d is in a running state."
%
count
)
while
test_result_line_proxy
.
isRunning
()
and
test_result_proxy
.
isAlive
():
time
.
sleep
(
15
)
pass
# Check test case state
# Wait for test case ending
if
test_result_line_proxy
.
isCompleted
():
test_case_start_time
=
time
.
time
()
self
.
log
(
"Test case completed."
)
while
test_result_line_proxy
.
isTestCaseAlive
()
and
\
error
=
None
test_result_proxy
.
isAlive
()
and
\
elif
not
test_result_proxy
.
isAlive
():
time
.
time
()
-
test_case_start_time
<
MAX_TEST_CASE_TIME
:
self
.
log
(
"Test cancelled."
)
time
.
sleep
(
15
)
# Here do somethig with instances
error
=
ValueError
(
"Test cancelled"
)
break
;
elif
test_result_line_proxy
.
isFailed
():
self
.
log
(
"Test failed."
)
# Here do somethig with instances
error
=
ValueError
(
"Test failed"
)
break
;
elif
test_result_line_proxy
.
isCancelled
():
self
.
log
(
"Test cancelled."
)
# Here do somethig with instances
error
=
ValueError
(
"Test has been cancelled"
)
break
;
elif
test_result_line_proxy
.
isRunning
():
self
.
log
(
"Test always running after max time elapsed."
)
# Here do somethig with instances
error
=
ValueError
(
"Max time for this test case is elapsed."
)
break
;
else
:
self
.
log
(
"Test in a undeterminated state."
)
error
=
ValueError
(
"Test case is in an undeterminated state"
)
break
;
# Stop instance
# Max time limit reach for current test case: failure.
if
test_result_line_proxy
.
isTestCaseAlive
():
error_message
=
"Test case during for %s seconds, too long. (max: %s seconds). Test failure."
\
%
(
str
(
time
.
time
()
-
test_case_start_time
),
MAX_TEST_CASE_TIME
)
error
=
ValueError
(
error_message
)
test_result_proxy
.
reportFailure
(
stdout
=
error_message
)
break
# Test cancelled or in an undeterminate state.
if
not
test_result_proxy
.
isAlive
():
error_message
=
"Test cancelled or undeterminate state."
error
=
ValueError
(
error_message
)
break
# Stop current instance
self
.
slapos_controler
.
stopInstance
(
self
.
instance_title
)
self
.
slapos_controler
.
stopInstance
(
self
.
instance_title
)
self
.
_waitInstance
(
self
.
instance_title
,
'stopped'
)
self
.
_waitInstance
(
self
.
instance_title
,
'stopped'
)
#self.slapos_controler.destroyInstance(self.instance_title)
# Delete old instances
# Delete old instances
self
.
_cleanUpOldInstance
()
self
.
_cleanUpOldInstance
()
# If error appears then that's a test failure.
if
error
:
if
error
:
test_result_proxy
.
fail
()
test_result_proxy
.
fail
()
raise
error
raise
error
#else:
#else:
#test_result_proxy.stop()
#test_result_proxy.stop()
return
{
'status_code'
:
0
}
return
{
'status_code'
:
0
}
def
_cleanUpOldInstance
(
self
):
def
_cleanUpOldInstance
(
self
):
self
.
log
(
"_cleanUpOldInstance"
)
self
.
log
(
"_cleanUpOldInstance"
)
# Get title and link list of all instances
# Get title and link list of all instances
instance_dict
=
self
.
slapos_communicator
.
getHostingSubscriptionDict
()
instance_dict
=
self
.
slapos_communicator
.
getHostingSubscriptionDict
()
instance_to_delete_list
=
[]
instance_to_delete_list
=
[]
outdated_date
=
datetime
.
datetime
.
fromtimestamp
(
time
.
time
())
-
datetime
.
timedelta
(
days
=
2
)
outdated_date
=
datetime
.
datetime
.
fromtimestamp
(
time
.
time
())
-
datetime
.
timedelta
(
days
=
2
)
# Select instances to delete
# Select instances to delete
for
title
,
link
in
instance_dict
.
items
():
for
title
,
link
in
instance_dict
.
items
():
# Instances created by testnode contains "Scalability-" and
# Instances created by testnode contains "Scalability-" and
...
...
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