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
Amer
erp5
Commits
d48f8bb7
Commit
d48f8bb7
authored
Mar 15, 2016
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_result: allow to define slapos parameters in test suites
parent
5f21add3
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
507 additions
and
32 deletions
+507
-32
bt5/erp5_test_result/ActionTemplateItem/portal_types/Test%20Result/view_node_list.xml
...emplateItem/portal_types/Test%20Result/view_node_list.xml
+1
-1
bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+1
-0
bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/Test%20Suite.xml
...sult/PortalTypeTemplateItem/portal_types/Test%20Suite.xml
+1
-3
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/Base_validateJSON.py
...teItem/portal_skins/erp5_test_result/Base_validateJSON.py
+7
-0
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/Base_validateJSON.xml
...eItem/portal_skins/erp5_test_result/Base_validateJSON.xml
+62
-0
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_init.py
...plateItem/portal_skins/erp5_test_result/TestSuite_init.py
+7
-0
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_init.xml
...lateItem/portal_skins/erp5_test_result/TestSuite_init.xml
+62
-0
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view.xml
...lateItem/portal_skins/erp5_test_result/TestSuite_view.xml
+3
-1
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/my_cluster_configuration.xml
...5_test_result/TestSuite_view/my_cluster_configuration.xml
+306
-0
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
...eItem/portal_components/test.erp5.testTaskDistribution.py
+15
-1
bt5/erp5_test_result/bt/template_portal_type_property_sheet_list
...5_test_result/bt/template_portal_type_property_sheet_list
+1
-0
erp5/util/testnode/NodeTestSuite.py
erp5/util/testnode/NodeTestSuite.py
+0
-1
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+4
-21
erp5/util/testnode/UnitTestRunner.py
erp5/util/testnode/UnitTestRunner.py
+13
-3
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+5
-0
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
+19
-1
No files found.
bt5/erp5_test_result/ActionTemplateItem/portal_types/Test%20Result/view_node_list.xml
View file @
d48f8bb7
...
...
@@ -52,7 +52,7 @@
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1
.0
</float>
</value>
<value>
<float>
2
.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
d48f8bb7
...
...
@@ -48,6 +48,7 @@
<portal_type
id=
"Test Suite"
>
<item>
Arrow
</item>
<item>
Reference
</item>
<item>
ScalabilityTestSuite
</item>
<item>
SortIndex
</item>
<item>
TestSuite
</item>
<item>
TestSuiteConstraint
</item>
...
...
bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/Test%20Suite.xml
View file @
d48f8bb7
...
...
@@ -36,9 +36,7 @@
</item>
<item>
<key>
<string>
init_script
</string>
</key>
<value>
<none/>
</value>
<value>
<string>
TestSuite_init
</string>
</value>
</item>
<item>
<key>
<string>
permission
</string>
</key>
...
...
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/Base_validateJSON.py
0 → 100644
View file @
d48f8bb7
import
json
result
=
True
try
:
json
.
loads
(
json_string
)
except
ValueError
:
result
=
False
return
result
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/Base_validateJSON.xml
0 → 100644
View file @
d48f8bb7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
json_string, request
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_validateJSON
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_init.py
0 → 100644
View file @
d48f8bb7
# Required to avoid useless writes on disk
# and to have some database for tests
context
.
setClusterConfiguration
(
"""{"mariadb": {
"relaxed-writes": true,
"mariadb-relaxed-writes": true,
"test-database-amount": 30}
}"""
)
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_init.xml
0 → 100644
View file @
d48f8bb7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestSuite_init
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view.xml
View file @
d48f8bb7
...
...
@@ -82,7 +82,9 @@
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
<list>
<string>
my_cluster_configuration
</string>
</list>
</value>
</item>
<item>
...
...
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/my_cluster_configuration.xml
0 → 100644
View file @
d48f8bb7
This diff is collapsed.
Click to expand it.
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
View file @
d48f8bb7
...
...
@@ -104,9 +104,10 @@ class TestTaskDistribution(ERP5TypeTestCase):
int_index
=
priority
,
specialise_value
=
specialise_value
,
)
test_suite
.
setClusterConfiguration
(
cluster_configuration
)
if
portal_type
==
"Scalability Test Suite"
:
test_suite
.
setGraphCoordinate
(
graph_coordinate
)
test_suite
.
setClusterConfiguration
(
cluster_configuration
)
test_suite
.
newContent
(
portal_type
=
'Test Suite Repository'
,
...
...
@@ -391,6 +392,19 @@ class TestTaskDistribution(ERP5TypeTestCase):
def
test_10_cancelTestResult
(
self
):
pass
def
test_10b_generateConfiguration
(
self
):
"""
It shall be possible on a test suite to define configuration we would like
to use to create slapos instance.
"""
test_suite
,
=
self
.
_createTestSuite
(
cluster_configuration
=
None
)
self
.
tic
()
self
.
assertEquals
(
'{"configuration_list": [{}]}'
,
self
.
distributor
.
generateConfiguration
(
test_suite
.
getTitle
()))
test_suite
.
setClusterConfiguration
(
"{'foo': 3}"
)
self
.
assertEquals
(
'{"configuration_list": [{}]}'
,
self
.
distributor
.
generateConfiguration
(
test_suite
.
getTitle
()))
test_suite
.
setClusterConfiguration
(
'{"foo": 3}'
)
self
.
assertEquals
(
'{"configuration_list": [{"foo": 3}]}'
,
self
.
distributor
.
generateConfiguration
(
test_suite
.
getTitle
()))
def
_checkTestSuiteAggregateList
(
self
,
*
args
):
self
.
tic
()
self
.
_callOptimizeAlarm
()
...
...
bt5/erp5_test_result/bt/template_portal_type_property_sheet_list
View file @
d48f8bb7
...
...
@@ -26,6 +26,7 @@ Test Suite Repository | TestSuiteRepository
Test Suite Repository | TestSuiteRepositoryConstraint
Test Suite | Arrow
Test Suite | Reference
Test Suite | ScalabilityTestSuite
Test Suite | SortIndex
Test Suite | TestSuite
Test Suite | TestSuiteConstraint
\ No newline at end of file
erp5/util/testnode/NodeTestSuite.py
View file @
d48f8bb7
...
...
@@ -58,7 +58,6 @@ class SlapOSInstance(object):
def
_checkData
(
self
):
pass
class
NodeTestSuite
(
SlapOSInstance
):
"""
...
...
erp5/util/testnode/SlapOSControler.py
View file @
d48f8bb7
...
...
@@ -332,7 +332,7 @@ class SlapOSControler(object):
def
spawn
(
self
,
*
args
,
**
kw
):
return
self
.
process_manager
.
spawn
(
*
args
,
**
kw
)
def
runSoftwareRelease
(
self
,
config
,
environment
):
def
runSoftwareRelease
(
self
,
config
,
environment
,
**
kw
):
self
.
log
(
"SlapOSControler.runSoftwareRelease"
)
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
...
...
@@ -352,31 +352,14 @@ class SlapOSControler(object):
return
status_dict
def
runComputerPartition
(
self
,
config
,
environment
,
stdout
=
None
,
stderr
=
None
):
self
.
log
(
"SlapOSControler.runComputerPartition"
)
# 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
# instance. This is a hack which must be removed.
config
[
'instance_dict'
][
'report-url'
]
=
config
.
get
(
"report-url"
,
""
)
config
[
'instance_dict'
][
'report-project'
]
=
config
.
get
(
"report-project"
,
""
)
config
[
'instance_dict'
][
'suite-url'
]
=
config
.
get
(
"suite-url"
,
""
)
# XXX: Hack to minimize writes to storage holding MySQL databases.
# Note this is something we want for all test suites, so it would
# not be better to define this parameter on each test suite.
# XXX: Also move here the number of test db to create, so that software
# release stop create ones by default.
config
[
'instance_dict'
][
'_'
]
=
json
.
dumps
({
"mariadb"
:
{
"relaxed-writes"
:
True
,
"mariadb-relaxed-writes"
:
True
,
# BBB
"test-database-amount"
:
30
,
}})
stdout
=
None
,
stderr
=
None
,
cluster_configuration
=
None
,
**
kw
):
self
.
log
(
"SlapOSControler.runComputerPartition with cluster_config: %r"
%
(
cluster_configuration
,))
for
path
in
self
.
software_path_list
:
try
:
self
.
slap
.
registerOpenOrder
().
request
(
path
,
partition_reference
=
'testing partition %s'
%
\
self
.
software_path_list
.
index
(
path
),
partition_parameter_kw
=
c
onfig
[
'instance_dict'
]
)
partition_parameter_kw
=
c
luster_configuration
)
except
:
self
.
log
(
"SlapOSControler.runComputerPartition,
\
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
...
...
erp5/util/testnode/UnitTestRunner.py
View file @
d48f8bb7
...
...
@@ -89,7 +89,7 @@ class UnitTestRunner():
log
(
"Before status_dict = slapos_method(...)"
)
status_dict
=
slapos_method
(
self
.
testnode
.
config
,
environment
=
self
.
testnode
.
config
[
'environment'
],
)
**
kw
)
log
(
status_dict
)
log
(
"After status_dict = slapos_method(...)"
)
if
status_dict
[
'status_code'
]
!=
0
:
...
...
@@ -105,9 +105,18 @@ class UnitTestRunner():
We will build slapos software needed by the testnode itself,
like the building of selenium-runner by default
"""
# report-url, report-project and suite-url are required to seleniumrunner
# instance. This is a hack which must be removed.
cluster_configuration
=
{}
config
=
self
.
testnode
.
config
cluster_configuration
[
'report-url'
]
=
config
.
get
(
"report-url"
,
""
)
cluster_configuration
[
'report-project'
]
=
config
.
get
(
"report-project"
,
""
)
cluster_configuration
[
'suite-url'
]
=
config
.
get
(
"suite-url"
,
""
)
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"
))
software_path_list
=
self
.
testnode
.
config
.
get
(
"software_list"
),
cluster_configuration
=
cluster_configuration
)
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
"""
...
...
@@ -118,7 +127,8 @@ class UnitTestRunner():
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
])
software_path_list
=
[
node_test_suite
.
custom_profile_path
],
cluster_configuration
=
{
'_'
:
json
.
dumps
(
node_test_suite
.
cluster_configuration
)})
def
runTestSuite
(
self
,
node_test_suite
,
portal_url
,
log
=
None
):
config
=
self
.
testnode
.
config
...
...
erp5/util/testnode/testnode.py
View file @
d48f8bb7
...
...
@@ -393,6 +393,11 @@ from the distributor.")
self
.
registerSuiteLog
(
test_result
,
node_test_suite
)
self
.
checkRevision
(
test_result
,
node_test_suite
)
node_test_suite
.
edit
(
test_result
=
test_result
)
# get cluster configuration for this test suite, this is needed to
# know slapos parameters to user for creating instances
node_test_suite
.
edit
(
cluster_configuration
=
Utils
.
deunicodeData
(
json
.
loads
(
self
.
test_suite_portal
.
generateConfiguration
(
node_test_suite
.
test_suite_title
))[
'configuration_list'
][
0
]))
# Now prepare the installation of SlapOS and create instance
status_dict
=
runner
.
prepareSlapOSForTestSuite
(
node_test_suite
)
# Give some time so computer partitions may start
...
...
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
View file @
d48f8bb7
...
...
@@ -351,8 +351,9 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
title
=
SimpleQuery
(
comparison_operator
=
'='
,
title
=
suite_title
),
validation_state
=
'validated'
)
assert
len
(
test_suite_list
)
==
1
,
"We found %i test suite for %s"
%
(
len
(
test_suite_list
),
nam
e
)
len
(
test_suite_list
),
suite_titl
e
)
test_suite
=
test_suite_list
[
0
].
getObject
()
return
test_suite
security
.
declarePublic
(
"startUnitTest"
)
def
startUnitTest
(
self
,
test_result_path
,
exclude_list
=
()):
...
...
@@ -373,3 +374,20 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
test_result
=
portal
.
unrestrictedTraverse
(
test_path
)
test_suite_title
=
test_result
.
getTitle
()
return
portal
.
portal_task_distribution_tool
.
stopUnitTest
(
self
,
test_path
,
status_dict
)
security
.
declarePublic
(
"generateConfiguration"
)
def
generateConfiguration
(
self
,
test_suite_title
,
batch_mode
=
0
):
"""
return the list of configuration to create instances, in the case of ERP5 unit tests,
we will have only one configuration (unlike scalability tests). But for API consistency,
always return a list.
"""
test_suite
=
self
.
_getTestSuiteFromTitle
(
test_suite_title
)
cluster_configuration
=
test_suite
.
getClusterConfiguration
()
or
'{}'
try
:
generated_configuration
=
[
json
.
loads
(
cluster_configuration
)]
except
ValueError
:
generated_configuration
=
[{}]
if
batch_mode
:
return
generated_configuration
return
json
.
dumps
(
generated_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