Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Eteri
erp5_fork
Commits
0efe3ee9
Commit
0efe3ee9
authored
Jun 27, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: testnode test
parent
8717c124
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
48 deletions
+66
-48
erp5/util/benchmark/scalability_launcher.py
erp5/util/benchmark/scalability_launcher.py
+40
-42
erp5/util/taskdistribution/__init__.py
erp5/util/taskdistribution/__init__.py
+16
-4
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+10
-2
No files found.
erp5/util/benchmark/scalability_launcher.py
View file @
0efe3ee9
...
...
@@ -7,22 +7,26 @@ import time
import
sys
import
multiprocessing
import
errno
import
json
import
logging
import
logging.handlers
from
.argument
import
ArgumentType
from
.performance_tester
import
PerformanceTester
from
erp5.util
import
taskdistribution
from
erp5.util.testnode
import
testnodeUtils
class
ScalabilityTest
(
object
):
def
__init__
(
self
,
title
,
count
):
self
.
title
=
title
self
.
count
=
count
def
__init__
(
self
,
data
,
test_result
):
self
.
__dict__
=
{}
self
.
__dict__
.
update
(
data
)
self
.
test_result
=
test_result
def
stop
(
self
):
self
.
test_result
.
stopTestCase
(
self
.
relative_path
)
def
cancel
(
self
):
self
.
test_result
.
cancelTestCase
(
self
.
relative_path
)
def
dump
(
self
):
print
'<ScalabilityTest>'
print
'self.title: %s'
%
(
str
(
self
.
title
))
print
'self.count: %s'
%
(
str
(
self
.
count
))
class
ScalabilityLauncher
(
object
):
def
__init__
(
self
):
...
...
@@ -44,10 +48,13 @@ class ScalabilityLauncher(object):
self
.
log
=
logger
.
info
# Proxy to with erp5 master test_result
self
.
test_result
=
taskdistribution
.
TestResultProxyProxy
(
self
.
__argumentNamespace
.
portal_url
,
1.0
,
logger
,
self
.
__argumentNamespace
.
test_result_url
,
self
.
__argumentNamespace
.
node_title
,
self
.
__argumentNamespace
.
revision
)
self
.
test_result
=
taskdistribution
.
TestResultProxyProxy
(
self
.
__argumentNamespace
.
test_suite_master_url
,
1.0
,
self
.
log
,
self
.
__argumentNamespace
.
test_result_path
,
self
.
__argumentNamespace
.
node_title
,
self
.
__argumentNamespace
.
revision
)
@
staticmethod
def
_addParserArguments
(
parser
):
# Mandatory arguments
...
...
@@ -93,46 +100,37 @@ class ScalabilityLauncher(object):
"""
pass
def
updateTestResultLineStatus
(
self
,
state
):
def
getNextTest
(
self
):
"""
Update state of a test_result_line
Return a ScalabilityTest with current running test case informations,
or None if no test_case ready
"""
# TODO : set a line per count value and use setState (?)
#
pass
def
_getNextTest
(
self
):
"""
Get testsuite parameters
"""
title
=
"My Sweet Title"
count
=
1
next_test
=
ScalabilityTest
(
title
,
count
)
data
=
self
.
test_result
.
getNextTestCase
()
if
data
==
None
:
return
None
decoded_data
=
testnodeUtils
.
deunicodeData
(
json
.
loads
(
data
))
next_test
=
ScalabilityTest
(
decoded_data
,
self
.
test_result
)
return
next_test
def
run
(
self
):
self
.
log
(
"Scalability Launcher started"
)
max_time
=
1
0
max_time
=
3600
0
start_time
=
time
.
time
()
error_message_set
,
exit_status
=
set
(),
0
test_result
=
taskdistribution
.
TestResultProxyProxy
(
self
.
__argumentNamespace
.
test_suite_master_url
,
1.0
,
self
.
log
,
self
.
__argumentNamespace
.
test_result_path
,
self
.
__argumentNamespace
.
node_title
,
self
.
__argumentNamespace
.
revision
)
#self.log("%s", self.test_result.isAlive())
while
time
.
time
()
-
start_time
<
max_time
:
current_test
=
self
.
_getNextTest
()
current_test
.
dump
()
time
.
sleep
(
2
)
current_test
=
self
.
getNextTest
()
if
current_test
==
None
:
self
.
log
(
"No Test Case Ready"
)
time
.
sleep
(
5
)
else
:
# Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ?
self
.
log
(
"Test Case %s is running..."
%
(
current_test
.
title
))
current_test
.
stop
()
self
.
log
(
"Test Case Stopped"
)
# Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ?
return
error_message_set
,
exit_status
def
main
():
...
...
erp5/util/taskdistribution/__init__.py
View file @
0efe3ee9
...
...
@@ -386,7 +386,7 @@ class TestResultProxyProxy(TestResultProxy):
node_title
,
revision
):
try
:
proxy
=
ServerProxy
(
portal
_url
,
test_suite_master
_url
,
allow_none
=
True
,
).
portal_task_distribution
except
:
...
...
@@ -394,12 +394,24 @@ class TestResultProxyProxy(TestResultProxy):
TestResultProxy
.
__init__
(
self
,
proxy
,
retry_time
,
logger
,
test_result_path
,
node_title
,
revision
)
def
getNextTest
ResultLinePath
(
self
):
def
getNextTest
Case
(
self
):
"""
A proxy to getNextTest
ResultLinePath
A proxy to getNextTest
Case
Return the relative path of the test with the running state
"""
return
bool
(
self
.
_retryRPC
(
'getNextTestResultLinePath'
,
[
self
.
_test_result_path
]))
return
self
.
_retryRPC
(
'getNextTestCase'
,
[
self
.
_test_result_path
])
def
cancelTestCase
(
self
,
test_result_line_path
):
"""
"""
return
self
.
_retryRPC
(
'cancelTestCase'
,
[
test_result_line_path
])
def
stopTestCase
(
self
,
test_result_line_path
):
"""
"""
return
self
.
_retryRPC
(
'stopTestCase'
,
[
test_result_line_path
])
...
...
erp5/util/testnode/ScalabilityTestRunner.py
View file @
0efe3ee9
...
...
@@ -109,7 +109,7 @@ class ScalabilityTestRunner():
config
.
update
({
'scalability-launcher-title'
:
'MyTestNodeTitle'
})
config
.
update
({
'test-result-path'
:
test_result
.
test_result_path
})
config
.
update
({
'test-suite-revision'
:
test_result
.
revision
})
config
.
update
({
'test-suite-master-url'
:
self
.
config
[
'test_suite_master_url'
]})
config
.
update
({
'test-suite-master-url'
:
self
.
testnode
.
config
[
'test_suite_master_url'
]})
return
config
def
_createInstance
(
self
,
software_path
,
software_configuration
,
instance_title
,
...
...
@@ -301,6 +301,13 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
exclude_list
=
[
x
for
x
in
test_list
if
x
!=
test_list
[
count
]]
count
+=
1
test_result_line_proxy
=
test_result_proxy
.
start
(
exclude_list
)
# No more test to run
if
test_result_line_proxy
==
None
:
# Hum normal ?
self
.
log
(
"Already tested."
)
# Clean up
return
{
'status_code'
:
0
}
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
)
...
...
@@ -327,7 +334,8 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
else
:
self
.
log
(
"Test in a undeterminated state."
)
raise
ValueError
(
"Test case is in an undeterminated state"
)
# todo : something like test_result_line_proxy.stop()
return
{
'status_code'
:
0
}
def
_cleanUpNodesInformation
(
self
):
...
...
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