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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e9f4d77f
Commit
e9f4d77f
authored
Aug 19, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proof of concept to reuse testnode infrastructure to run DREAM simulation scenarios
parent
1c827f20
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
730 additions
and
22 deletions
+730
-22
bt5/erp5_test_result/ActionTemplateItem/portal_types/DREAM%20Simulation%20Distributor/view.xml
...em/portal_types/DREAM%20Simulation%20Distributor/view.xml
+85
-0
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.DREAMSimulationDistributor.py
...al_components/document.erp5.DREAMSimulationDistributor.py
+241
-0
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.DREAMSimulationDistributor.xml
...l_components/document.erp5.DREAMSimulationDistributor.xml
+123
-0
bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
...eAllowedContentTypeTemplateItem/allowed_content_types.xml
+1
-0
bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/DREAM%20Simulation%20Distributor.xml
...ateItem/portal_types/DREAM%20Simulation%20Distributor.xml
+64
-0
bt5/erp5_test_result/bt/template_action_path_list
bt5/erp5_test_result/bt/template_action_path_list
+1
-0
bt5/erp5_test_result/bt/template_document_id_list
bt5/erp5_test_result/bt/template_document_id_list
+1
-0
bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list
..._result/bt/template_portal_type_allowed_content_type_list
+1
-0
bt5/erp5_test_result/bt/template_portal_type_id_list
bt5/erp5_test_result/bt/template_portal_type_id_list
+1
-0
erp5/util/testnode/DREAMSimulationRunner.py
erp5/util/testnode/DREAMSimulationRunner.py
+169
-0
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+23
-19
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+20
-3
No files found.
bt5/erp5_test_result/ActionTemplateItem/portal_types/DREAM%20Simulation%20Distributor/view.xml
0 → 100644
View file @
e9f4d77f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
view
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
View
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/ERP5ProjectUnitTestDistributor_view
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.DREAMSimulationDistributor.py
0 → 100644
View file @
e9f4d77f
This diff is collapsed.
Click to expand it.
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.DREAMSimulationDistributor.xml
0 → 100644
View file @
e9f4d77f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Document Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
DREAMSimulationDistributor
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.DREAMSimulationDistributor
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Document Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
View file @
e9f4d77f
...
...
@@ -7,6 +7,7 @@
</portal_type>
<portal_type
id=
"Task Distribution Tool"
>
<item>
Cloud Performance Unit Test Distributor
</item>
<item>
DREAM Simulation Distributor
</item>
<item>
ERP5 Project Unit Test Distributor
</item>
<item>
ERP5 Scalability Distributor
</item>
</portal_type>
...
...
bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/DREAM%20Simulation%20Distributor.xml
0 → 100644
View file @
e9f4d77f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Base Type"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
content_icon
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
factory
</string>
</key>
<value>
<string>
addXMLObject
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
DREAM Simulation Distributor
</string>
</value>
</item>
<item>
<key>
<string>
init_script
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
permission
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Base Type
</string>
</value>
</item>
<item>
<key>
<string>
type_class
</string>
</key>
<value>
<string>
DREAMSimulationDistributor
</string>
</value>
</item>
<item>
<key>
<string>
type_interface
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
type_mixin
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_test_result/bt/template_action_path_list
View file @
e9f4d77f
Benchmark Result Line | view
Benchmark Result | view
Cloud Performance Unit Test Distributor | view
DREAM Simulation Distributor | view
ERP5 Project Unit Test Distributor | view
ERP5 Scalability Distributor | view
Scalability Test Suite | vcs_repository
...
...
bt5/erp5_test_result/bt/template_document_id_list
View file @
e9f4d77f
document.erp5.TestNode
document.erp5.TestSuite
document.erp5.ERP5ScalabilityDistributor
document.erp5.DREAMSimulationDistributor
\ No newline at end of file
bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list
View file @
e9f4d77f
Benchmark Result | Benchmark Result Line
Scalability Test Suite | Test Suite Repository
Task Distribution Tool | Cloud Performance Unit Test Distributor
Task Distribution Tool | DREAM Simulation Distributor
Task Distribution Tool | ERP5 Project Unit Test Distributor
Task Distribution Tool | ERP5 Scalability Distributor
Test Node Module | Test Node
...
...
bt5/erp5_test_result/bt/template_portal_type_id_list
View file @
e9f4d77f
Benchmark Result
Benchmark Result Line
Cloud Performance Unit Test Distributor
DREAM Simulation Distributor
ERP5 Project Unit Test Distributor
ERP5 Scalability Distributor
Scalability Test Suite
...
...
erp5/util/testnode/DREAMSimulationRunner.py
0 → 100644
View file @
e9f4d77f
##############################################################################
#
# Copyright (c) 2014 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
datetime
import
datetime
,
timedelta
import
os
import
subprocess
import
sys
import
time
import
tempfile
import
glob
import
SlapOSControler
import
json
import
time
import
shutil
import
logging
import
string
import
random
from
ProcessManager
import
SubprocessError
,
ProcessManager
,
CancellationError
from
subprocess
import
CalledProcessError
from
NodeTestSuite
import
SlapOSInstance
from
Updater
import
Updater
from
Utils
import
dealShebang
from
erp5.util
import
taskdistribution
class
DREAMSimulationRunner
():
def
__init__
(
self
,
testnode
):
self
.
testnode
=
testnode
def
_getSlapOSControler
(
self
,
working_directory
):
"""
Create a SlapOSControler for this working dir
"""
return
SlapOSControler
.
SlapOSControler
(
working_directory
,
self
.
testnode
.
config
,
self
.
testnode
.
log
)
def
_prepareSlapOS
(
self
,
working_directory
,
slapos_instance
,
log
,
build_software
=
1
,
software_path_list
=
None
,
**
kw
):
"""Launch slapos to build software and partitions
XXX: only build & create partition once for DREAM
"""
slapproxy_log
=
os
.
path
.
join
(
self
.
testnode
.
config
[
'log_directory'
],
'slapproxy.log'
)
log
(
'Configured slapproxy log to %r'
%
slapproxy_log
)
reset_software
=
slapos_instance
.
retry_software_count
>
10
if
reset_software
:
slapos_instance
.
retry_software_count
=
0
reset_software
=
False
# Never delete ...
log
(
'testnode, retry_software_count : %r'
%
\
slapos_instance
.
retry_software_count
)
# XXX Create a new controler because working_directory can be
# Different depending of the preparation
slapos_controler
=
self
.
_getSlapOSControler
(
working_directory
)
slapos_controler
.
initializeSlapOSControler
(
slapproxy_log
=
slapproxy_log
,
process_manager
=
self
.
testnode
.
process_manager
,
reset_software
=
reset_software
,
software_path_list
=
software_path_list
)
self
.
testnode
.
process_manager
.
supervisord_pid_file
=
os
.
path
.
join
(
\
slapos_controler
.
instance_root
,
'var'
,
'run'
,
'supervisord.pid'
)
# XXX If all software looks already build, we will not run soft again
soft_list
=
glob
.
glob
(
os
.
path
.
join
(
slapos_instance
.
working_directory
,
'soft'
,
'*'
))
completed_soft_list
=
glob
.
glob
(
os
.
path
.
join
(
slapos_instance
.
working_directory
,
'soft'
,
'*'
,
'.completed'
))
if
soft_list
and
len
(
soft_list
)
==
len
(
completed_soft_list
):
log
(
'testnode: all software seem built, will not build again'
)
build_software
=
False
if
build_software
:
status_dict
=
slapos_controler
.
runSoftwareRelease
(
self
.
testnode
.
config
,
environment
=
self
.
testnode
.
config
[
'environment'
])
if
status_dict
[
'status_code'
]
!=
0
:
slapos_instance
.
retry
=
True
slapos_instance
.
retry_software_count
+=
1
raise
SubprocessError
(
status_dict
)
slapos_instance
.
retry_software_count
=
0
status_dict
=
slapos_controler
.
runComputerPartition
(
self
.
testnode
.
config
,
environment
=
self
.
testnode
.
config
[
'environment'
],
implicit_erp5_config
=
False
)
if
status_dict
[
'status_code'
]
!=
0
:
slapos_instance
.
retry
=
True
slapos_instance
.
retry_software_count
+=
1
raise
SubprocessError
(
status_dict
)
slapos_instance
.
retry_software_count
=
0
return
status_dict
def
prepareSlapOSForTestNode
(
self
,
test_node_slapos
):
"""
We will build slapos software needed by the testnode itself,
like the building of selenium-runner by default
"""
# I don't think we need that
return
{}
return
self
.
_prepareSlapOS
(
self
.
testnode
.
config
[
'slapos_directory'
],
test_node_slapos
,
self
.
testnode
.
log
,
create_partition
=
0
,
software_path_list
=
self
.
testnode
.
config
.
get
(
"software_list"
))
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
"""
Build softwares needed by testsuites
"""
log
=
self
.
testnode
.
log
if
log
is
None
:
log
=
self
.
testnode
.
log
return
self
.
_prepareSlapOS
(
node_test_suite
.
working_directory
,
node_test_suite
,
log
,
software_path_list
=
[
node_test_suite
.
custom_profile_path
])
def
runSimulationScenario
(
self
,
node_test_suite
,
portal_url
,
test_result
):
if
not
node_test_suite
.
scenario
:
return
# nothing to do
dream_simulation
=
glob
.
glob
(
"%s/inst/*/etc/run/dream_simulation"
%
\
node_test_suite
.
working_directory
)[
0
]
with
tempfile
.
NamedTemporaryFile
()
as
tf
:
tf
.
write
(
json
.
dumps
(
json
.
loads
(
node_test_suite
.
scenario
)[
'input'
]))
tf
.
flush
()
invocation_list
=
[
dream_simulation
,
tf
.
name
]
status_dict
=
self
.
testnode
.
process_manager
.
spawn
(
*
invocation_list
,
cwd
=
node_test_suite
.
working_directory
,
log_prefix
=
'dream_simulation'
,
get_output
=
True
)
output
=
status_dict
[
'stdout'
]
assert
output
self
.
testnode
.
log
(
'Posting back result for %s/%s'
%
(
test_result
.
test_result_path
,
node_test_suite
.
test_result_line_id
))
test_result
.
_retryRPC
(
'saveDREAMSimulationResult'
,
(
'%s/%s'
%
(
test_result
.
test_result_path
,
node_test_suite
.
test_result_line_id
),
output
))
def
getRelativePathUsage
(
self
):
"""
Used by the method testnode.constructProfile() to know
if the software.cfg have to use relative path or not.
"""
return
False
erp5/util/testnode/SlapOSControler.py
View file @
e9f4d77f
...
...
@@ -359,8 +359,12 @@ class SlapOSControler(object):
return
status_dict
def
runComputerPartition
(
self
,
config
,
environment
,
stdout
=
None
,
stderr
=
None
):
stdout
=
None
,
stderr
=
None
,
implicit_erp5_config
=
True
):
self
.
log
(
"SlapOSControler.runComputerPartition"
)
# XXX implicit_erp5_config should not be here but passed by classes
# depending on it
if
implicit_erp5_config
:
# cloudooo-json is required but this is a hack which should be removed
config
[
'instance_dict'
][
'cloudooo-json'
]
=
"{}"
# report-url, report-project and suite-url are required to seleniumrunner
...
...
erp5/util/testnode/testnode.py
View file @
e9f4d77f
...
...
@@ -46,6 +46,7 @@ from subprocess import CalledProcessError
from
Updater
import
Updater
from
NodeTestSuite
import
NodeTestSuite
,
SlapOSInstance
from
ScalabilityTestRunner
import
ScalabilityTestRunner
from
DREAMSimulationRunner
import
DREAMSimulationRunner
from
UnitTestRunner
import
UnitTestRunner
from
erp5.util
import
taskdistribution
...
...
@@ -137,7 +138,6 @@ class TestNode(object):
node_test_suite
.
reference
)
software_config_path
=
os
.
path
.
relpath
(
software_config_path
,
from_path
)
profile_content_list
.
append
(
"""
[buildout]
extends = %(software_config_path)s
...
...
@@ -188,6 +188,10 @@ branch = %(branch)s
sys
.
path
.
append
(
repository_path
)
def
getAndUpdateFullRevisionList
(
self
,
node_test_suite
):
if
0
:
# already checkout
self
.
log
(
"no getAndUpdateFullRevisionList ..."
)
node_test_suite
.
revision
=
0
,
0
return
[]
full_revision_list
=
[]
config
=
self
.
config
log
=
self
.
log
...
...
@@ -224,6 +228,9 @@ branch = %(branch)s
return
self
.
suite_log
def
_initializeSuiteLog
(
self
,
suite_log_path
):
logger
=
logging
.
getLogger
(
'testsuite'
)
self
.
suite_log
=
logger
.
info
return
# remove previous handlers
logger
=
logging
.
getLogger
(
'testsuite'
)
if
self
.
file_handler
is
not
None
:
...
...
@@ -239,6 +246,9 @@ branch = %(branch)s
self
.
suite_log
=
logger
.
info
def
checkRevision
(
self
,
test_result
,
node_test_suite
):
self
.
log
(
"skipping checkRevision"
)
return
# no check revision
config
=
self
.
config
log
=
self
.
log
if
log
is
None
:
...
...
@@ -349,6 +359,8 @@ from the distributor.")
runner
=
UnitTestRunner
(
self
)
elif
my_test_type
==
'ScalabilityTest'
:
runner
=
ScalabilityTestRunner
(
self
)
elif
my_test_type
==
'DREAMSimulation'
:
runner
=
DREAMSimulationRunner
(
self
)
else
:
log
(
"testnode, Runner type %s not implemented."
,
my_test_type
)
raise
NotImplementedError
...
...
@@ -371,6 +383,8 @@ from the distributor.")
runner
=
UnitTestRunner
(
node_test_suite
)
elif
my_test_type
==
'ScalabilityTest'
:
runner
=
ScalabilityTestRunner
(
node_test_suite
)
elif
my_test_type
==
'DREAMSimulation'
:
runner
=
DREAMSimulationRunner
(
node_test_suite
)
else
:
log
(
"testnode, Runner type %s not implemented."
,
my_test_type
)
raise
NotImplementedError
...
...
@@ -401,7 +415,7 @@ from the distributor.")
# Give some time so computer partitions may start
# as partitions can be of any kind we have and likely will never have
# a reliable way to check if they are up or not ...
time
.
sleep
(
20
)
time
.
sleep
(
1
)
if
my_test_type
==
'UnitTest'
:
runner
.
runTestSuite
(
node_test_suite
,
portal_url
)
elif
my_test_type
==
'ScalabilityTest'
:
...
...
@@ -422,9 +436,11 @@ from the distributor.")
)
self
.
log
(
error_message
)
raise
ValueError
(
error_message
)
elif
my_test_type
==
'DREAMSimulation'
:
runner
.
runSimulationScenario
(
node_test_suite
,
portal_url
,
test_result
)
else
:
raise
NotImplementedError
# break the loop to get latest priorities from master
break
self
.
cleanUp
(
test_result
)
...
...
@@ -457,6 +473,7 @@ from the distributor.")
self
.
cleanUp
(
test_result
)
if
(
now
-
begin
)
<
120
:
sleep_time
=
120
-
(
now
-
begin
)
sleep_time
=
.
1
log
(
"End of processing, going to sleep %s"
%
sleep_time
)
time
.
sleep
(
sleep_time
)
except
:
...
...
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