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
Léo-Paul Géneau
erp5
Commits
5d09ea96
Commit
5d09ea96
authored
Oct 19, 2017
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5testnode] Use only taskdistribution.TaskDistributor
This results with calling correct methods on the server.
parent
fa9c4e83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
29 deletions
+62
-29
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+15
-16
erp5/util/taskdistribution/__init__.py
erp5/util/taskdistribution/__init__.py
+40
-4
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+7
-9
No files found.
erp5/tests/testERP5TestNode.py
View file @
5d09ea96
...
@@ -13,7 +13,6 @@ from erp5.util.testnode.ScalabilityTestRunner import ScalabilityTestRunner
...
@@ -13,7 +13,6 @@ from erp5.util.testnode.ScalabilityTestRunner import ScalabilityTestRunner
from
erp5.util.testnode.SlapOSControler
import
createFolder
from
erp5.util.testnode.SlapOSControler
import
createFolder
from
erp5.util.taskdistribution
import
TaskDistributor
from
erp5.util.taskdistribution
import
TaskDistributor
from
erp5.util.taskdistribution
import
TaskDistributionTool
from
erp5.util.taskdistribution
import
TestResultProxy
from
erp5.util.taskdistribution
import
TestResultProxy
import
argparse
import
argparse
import
os
import
os
...
@@ -674,11 +673,11 @@ shared = true
...
@@ -674,11 +673,11 @@ shared = true
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_getTestType
=
TaskDistributor
.
getTestType
original_getTestType
=
TaskDistributor
.
getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
# TestNode
# TestNode
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
...
@@ -703,9 +702,9 @@ shared = true
...
@@ -703,9 +702,9 @@ shared = true
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
RunnerClass
.
runTestSuite
=
original_runTestSuite
...
@@ -841,8 +840,8 @@ shared = true
...
@@ -841,8 +840,8 @@ shared = true
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistributor
.
getTestType
=
patch_getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
# Change UnitTestRunner class methods
# Change UnitTestRunner class methods
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
...
@@ -873,9 +872,9 @@ shared = true
...
@@ -873,9 +872,9 @@ shared = true
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
RunnerClass
.
runTestSuite
=
original_runTestSuite
...
@@ -1049,7 +1048,7 @@ shared = true
...
@@ -1049,7 +1048,7 @@ shared = true
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_getTestType
=
TaskDistributor
.
getTestType
original_getTestType
=
TaskDistributor
.
getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
original_runTestSuite
=
RunnerClass
.
runTestSuite
original_runTestSuite
=
RunnerClass
.
runTestSuite
original_supply
=
SlapOSControler
.
supply
original_supply
=
SlapOSControler
.
supply
...
@@ -1067,7 +1066,7 @@ shared = true
...
@@ -1067,7 +1066,7 @@ shared = true
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
RunnerClass
.
_prepareSlapOS
=
doNothing
RunnerClass
.
_prepareSlapOS
=
doNothing
RunnerClass
.
runTestSuite
=
patch_runTestSuite
RunnerClass
.
runTestSuite
=
patch_runTestSuite
SlapOSControler
.
supply
=
doNothing
SlapOSControler
.
supply
=
doNothing
...
@@ -1085,9 +1084,9 @@ shared = true
...
@@ -1085,9 +1084,9 @@ shared = true
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
isMasterTestnode
=
original_isMasterTestnode
TaskDistributor
.
isMasterTestnode
=
original_isMasterTestnode
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
RunnerClass
.
runTestSuite
=
original_runTestSuite
SlapOSControler
.
supply
=
original_supply
SlapOSControler
.
supply
=
original_supply
...
...
erp5/util/taskdistribution/__init__.py
View file @
5d09ea96
...
@@ -29,7 +29,7 @@ Client implementation for portal_task_distribution.
...
@@ -29,7 +29,7 @@ Client implementation for portal_task_distribution.
Example use:
Example use:
import erp5.util.taskdistribution
import erp5.util.taskdistribution
tool = erp5.util.taskdistribution.TaskDistributionTool
(...)
distributor = erp5.util.taskdistribution.TaskDistributor
(...)
test_result = tool.createTestResult(...)
test_result = tool.createTestResult(...)
test_result.addWatch('foo', open('foo'))
test_result.addWatch('foo', open('foo'))
while True:
while True:
...
@@ -138,7 +138,7 @@ class TestResultLineProxy(RPCRetry):
...
@@ -138,7 +138,7 @@ class TestResultLineProxy(RPCRetry):
Properties:
Properties:
name (str) (ro)
name (str) (ro)
Test name, as provided to TaskDistribut
ionTool
.createTestResult .
Test name, as provided to TaskDistribut
or
.createTestResult .
"""
"""
def
__init__
(
self
,
proxy
,
retry_time
,
logger
,
test_result_line_path
,
def
__init__
(
self
,
proxy
,
retry_time
,
logger
,
test_result_line_path
,
test_name
):
test_name
):
...
@@ -468,9 +468,13 @@ class TaskDistributor(RPCRetry):
...
@@ -468,9 +468,13 @@ class TaskDistributor(RPCRetry):
if
logger
is
None
:
if
logger
is
None
:
logger
=
null_logger
logger
=
null_logger
if
portal_url
is
None
:
if
portal_url
is
None
:
proxy
=
DummyTaskDistribut
ionTool
()
proxy
=
DummyTaskDistribut
or
()
else
:
else
:
proxy
=
ServerProxy
(
portal_url
,
allow_none
=
True
)
proxy
=
ServerProxy
(
portal_url
,
allow_none
=
True
)
# create internal proxy to the tool in order to fall-back in case
# of old server
self
.
_tool_proxy
=
ServerProxy
(
portal_url
,
allow_none
=
True
).
portal_task_distribution
super
(
TaskDistributor
,
self
).
__init__
(
proxy
,
retry_time
,
logger
)
super
(
TaskDistributor
,
self
).
__init__
(
proxy
,
retry_time
,
logger
)
protocol_revision
=
self
.
_retryRPC
(
'getProtocolRevision'
)
protocol_revision
=
self
.
_retryRPC
(
'getProtocolRevision'
)
if
protocol_revision
!=
1
:
if
protocol_revision
!=
1
:
...
@@ -538,8 +542,40 @@ class TaskDistributor(RPCRetry):
...
@@ -538,8 +542,40 @@ class TaskDistributor(RPCRetry):
"""
"""
return
self
.
_retryRPC
(
'getSlaposHateoasUrl'
)
return
self
.
_retryRPC
(
'getSlaposHateoasUrl'
)
def
createTestResult
(
self
,
revision
,
test_name_list
,
node_title
,
allow_restart
=
False
,
test_title
=
None
,
project_title
=
None
):
"""
(maybe) create a new test run.
revision (str)
An opaque string describing code being tested.
test_name_list (list of str)
List of tests being part of this test run. May be empty.
node_title (str)
Human-readable test node identifier, so an adnmin can know which
node does what.
allow_restart (bool)
When true, a tet result is always created, even if a former finished
one is found for same name and revision pair.
test_title (str)
Human-readable title for test. Must be identical for successive runs.
Allows browsing its result history.
project_title (str)
Existing project title, so test result gets associated to it.
Returns None if no test run is needed (a test run for given name and
revision has already been completed).
Otherwise, returns a TestResultProxy instance.
"""
result
=
self
.
_retryRPC
(
'createTestResult'
,
(
''
,
revision
,
test_name_list
,
allow_restart
,
test_title
,
node_title
,
project_title
))
if
result
:
test_result_path
,
revision
=
result
result
=
TestResultProxy
(
self
.
_proxy
,
self
.
_retry_time
,
self
.
_logger
,
test_result_path
,
node_title
,
revision
)
return
result
class
DummyTaskDistribut
ionTool
(
object
):
class
DummyTaskDistribut
or
(
object
):
"""
"""
Fake remote server.
Fake remote server.
...
...
erp5/util/testnode/testnode.py
View file @
5d09ea96
...
@@ -316,13 +316,10 @@ shared = true
...
@@ -316,13 +316,10 @@ shared = true
remote_test_result_needs_cleanup
=
False
remote_test_result_needs_cleanup
=
False
begin
=
time
.
time
()
begin
=
time
.
time
()
portal_url
=
config
[
'test_suite_master_url'
]
portal_url
=
config
[
'test_suite_master_url'
]
portal
=
taskdistribution
.
TaskDistributionTool
(
portal_url
,
self
.
taskdistribution
=
taskdistribution
.
TaskDistributor
(
logger
=
DummyLogger
(
log
))
self
.
portal
=
portal
self
.
test_suite_portal
=
taskdistribution
.
TaskDistributor
(
portal_url
,
portal_url
,
logger
=
DummyLogger
(
log
))
logger
=
DummyLogger
(
log
))
node_configuration
=
self
.
t
est_suite_portal
.
subscribeNode
(
node_title
=
config
[
'test_node_title'
],
node_configuration
=
self
.
t
askdistribution
.
subscribeNode
(
node_title
=
config
[
'test_node_title'
],
computer_guid
=
config
[
'computer_id'
])
computer_guid
=
config
[
'computer_id'
])
if
type
(
node_configuration
)
==
str
:
if
type
(
node_configuration
)
==
str
:
# Backward compatiblity
# Backward compatiblity
...
@@ -334,7 +331,7 @@ shared = true
...
@@ -334,7 +331,7 @@ shared = true
log
(
'Received and using process timeout from master: %i'
%
(
log
(
'Received and using process timeout from master: %i'
%
(
process_timeout
))
process_timeout
))
self
.
process_manager
.
max_timeout
=
process_timeout
self
.
process_manager
.
max_timeout
=
process_timeout
test_suite_data
=
self
.
t
est_suite_portal
.
startTestSuite
(
test_suite_data
=
self
.
t
askdistribution
.
startTestSuite
(
node_title
=
config
[
'test_node_title'
],
node_title
=
config
[
'test_node_title'
],
computer_guid
=
config
[
'computer_id'
])
computer_guid
=
config
[
'computer_id'
])
if
type
(
test_suite_data
)
==
str
:
if
type
(
test_suite_data
)
==
str
:
...
@@ -344,7 +341,7 @@ shared = true
...
@@ -344,7 +341,7 @@ shared = true
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
.
t
est_suite_portal
.
getTestType
()
my_test_type
=
self
.
t
askdistribution
.
getTestType
()
except
Exception
:
except
Exception
:
log
(
"testnode, error during requesting getTestType() method"
log
(
"testnode, error during requesting getTestType() method"
" from the distributor."
)
" from the distributor."
)
...
@@ -392,7 +389,8 @@ shared = true
...
@@ -392,7 +389,8 @@ shared = true
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
runner
.
getRelativePathUsage
())
runner
.
getRelativePathUsage
())
# Make sure we have local repository
# Make sure we have local repository
test_result
=
portal
.
createTestResult
(
node_test_suite
.
revision
,
[],
test_result
=
self
.
taskdistribution
.
createTestResult
(
node_test_suite
.
revision
,
[],
config
[
'test_node_title'
],
False
,
config
[
'test_node_title'
],
False
,
node_test_suite
.
test_suite_title
,
node_test_suite
.
test_suite_title
,
node_test_suite
.
project_title
)
node_test_suite
.
project_title
)
...
@@ -405,7 +403,7 @@ shared = true
...
@@ -405,7 +403,7 @@ shared = true
# get cluster configuration for this test suite, this is needed to
# get cluster configuration for this test suite, this is needed to
# know slapos parameters to user for creating instances
# know slapos parameters to user for creating instances
log
(
"Getting configuration from test suite "
+
str
(
node_test_suite
.
test_suite_title
))
log
(
"Getting configuration from test suite "
+
str
(
node_test_suite
.
test_suite_title
))
generated_config
=
self
.
t
est_suite_portal
.
generateConfiguration
(
node_test_suite
.
test_suite_title
)
generated_config
=
self
.
t
askdistribution
.
generateConfiguration
(
node_test_suite
.
test_suite_title
)
json_data
=
json
.
loads
(
generated_config
)
json_data
=
json
.
loads
(
generated_config
)
cluster_configuration
=
Utils
.
deunicodeData
(
json_data
[
'configuration_list'
][
0
])
cluster_configuration
=
Utils
.
deunicodeData
(
json_data
[
'configuration_list'
][
0
])
node_test_suite
.
edit
(
cluster_configuration
=
cluster_configuration
)
node_test_suite
.
edit
(
cluster_configuration
=
cluster_configuration
)
...
...
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