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
Klaus Wölfel
erp5
Commits
8356b2cb
Commit
8356b2cb
authored
Oct 19, 2017
by
Łukasz Nowak
Committed by
Klaus Wölfel
Sep 06, 2018
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
23245a8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
32 deletions
+65
-32
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
+10
-12
No files found.
erp5/tests/testERP5TestNode.py
View file @
8356b2cb
...
...
@@ -13,7 +13,6 @@ from erp5.util.testnode.ScalabilityTestRunner import ScalabilityTestRunner
from
erp5.util.testnode.SlapOSControler
import
createFolder
from
erp5.util.taskdistribution
import
TaskDistributor
from
erp5.util.taskdistribution
import
TaskDistributionTool
from
erp5.util.taskdistribution
import
TestResultProxy
import
os
import
shutil
...
...
@@ -690,11 +689,11 @@ develop = false
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_getTestType
=
TaskDistributor
.
getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
# TestNode
test_node
=
self
.
getTestNode
()
...
...
@@ -719,9 +718,9 @@ develop = false
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
...
...
@@ -857,8 +856,8 @@ develop = false
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
test_node
=
self
.
getTestNode
()
# Change UnitTestRunner class methods
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
...
...
@@ -889,9 +888,9 @@ develop = false
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
...
...
@@ -1065,7 +1064,7 @@ develop = false
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_getTestType
=
TaskDistributor
.
getTestType
original_createTestResult
=
TaskDistribut
ionTool
.
createTestResult
original_createTestResult
=
TaskDistribut
or
.
createTestResult
original_prepareSlapOS
=
RunnerClass
.
_prepareSlapOS
original_runTestSuite
=
RunnerClass
.
runTestSuite
original_supply
=
SlapOSControler
.
supply
...
...
@@ -1083,7 +1082,7 @@ develop = false
TaskDistributor
.
startTestSuite
=
patch_startTestSuite
TaskDistributor
.
subscribeNode
=
doNothing
TaskDistributor
.
getTestType
=
patch_getTestType
TaskDistribut
ionTool
.
createTestResult
=
patch_createTestResult
TaskDistribut
or
.
createTestResult
=
patch_createTestResult
RunnerClass
.
_prepareSlapOS
=
doNothing
RunnerClass
.
runTestSuite
=
patch_runTestSuite
SlapOSControler
.
supply
=
doNothing
...
...
@@ -1101,9 +1100,9 @@ develop = false
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
isMasterTestnode
=
original_isMasterTestnode
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistribut
ionTool
.
createTestResult
=
original_createTestResult
TaskDistribut
ionTool
.
subscribeNode
=
original_subscribeNode
TaskDistribut
ionTool
.
getTestType
=
original_getTestType
TaskDistribut
or
.
createTestResult
=
original_createTestResult
TaskDistribut
or
.
subscribeNode
=
original_subscribeNode
TaskDistribut
or
.
getTestType
=
original_getTestType
RunnerClass
.
_prepareSlapOS
=
original_prepareSlapOS
RunnerClass
.
runTestSuite
=
original_runTestSuite
SlapOSControler
.
supply
=
original_supply
...
...
erp5/util/taskdistribution/__init__.py
View file @
8356b2cb
...
...
@@ -29,7 +29,7 @@ Client implementation for portal_task_distribution.
Example use:
import erp5.util.taskdistribution
tool = erp5.util.taskdistribution.TaskDistributionTool
(...)
distributor = erp5.util.taskdistribution.TaskDistributor
(...)
test_result = tool.createTestResult(...)
test_result.addWatch('foo', open('foo'))
while True:
...
...
@@ -138,7 +138,7 @@ class TestResultLineProxy(RPCRetry):
Properties:
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
,
test_name
):
...
...
@@ -468,9 +468,13 @@ class TaskDistributor(RPCRetry):
if
logger
is
None
:
logger
=
null_logger
if
portal_url
is
None
:
proxy
=
DummyTaskDistribut
ionTool
()
proxy
=
DummyTaskDistribut
or
()
else
:
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
)
protocol_revision
=
self
.
_retryRPC
(
'getProtocolRevision'
)
if
protocol_revision
!=
1
:
...
...
@@ -538,8 +542,40 @@ class TaskDistributor(RPCRetry):
"""
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.
...
...
erp5/util/testnode/testnode.py
View file @
8356b2cb
...
...
@@ -323,13 +323,10 @@ develop = false
remote_test_result_needs_cleanup
=
False
begin
=
time
.
time
()
portal_url
=
config
[
'test_suite_master_url'
]
portal
=
taskdistribution
.
TaskDistributionTool
(
portal_url
,
logger
=
DummyLogger
(
log
))
self
.
portal
=
portal
self
.
test_suite_portal
=
taskdistribution
.
TaskDistributor
(
self
.
taskdistribution
=
taskdistribution
.
TaskDistributor
(
portal_url
,
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'
])
if
type
(
node_configuration
)
==
str
:
# Backward compatiblity
...
...
@@ -341,7 +338,7 @@ develop = false
log
(
'Received and using process timeout from master: %i'
%
(
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'
],
computer_guid
=
config
[
'computer_id'
])
if
type
(
test_suite_data
)
==
str
:
...
...
@@ -351,10 +348,10 @@ develop = false
log
(
"Got following test suite data from master : %r"
%
\
(
test_suite_data
,))
try
:
my_test_type
=
self
.
t
est_suite_portal
.
getTestType
()
except
:
log
(
"testnode, error during requesting getTestType() method
\
from the distributor."
)
my_test_type
=
self
.
t
askdistribution
.
getTestType
()
except
Exception
:
log
(
"testnode, error during requesting getTestType() method
"
"
from the distributor."
)
raise
# Select runner according to the test type
if
my_test_type
==
'UnitTest'
:
...
...
@@ -400,7 +397,8 @@ from the distributor.")
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
runner
.
getRelativePathUsage
())
# 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
,
node_test_suite
.
test_suite_title
,
node_test_suite
.
project_title
)
...
...
@@ -413,7 +411,7 @@ from the distributor.")
# get cluster configuration for this test suite, this is needed to
# know slapos parameters to user for creating instances
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
)
cluster_configuration
=
Utils
.
deunicodeData
(
json_data
[
'configuration_list'
][
0
])
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