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
Titouan Soulard
erp5
Commits
35e1a629
Commit
35e1a629
authored
Oct 07, 2022
by
Kazuhiko Shiozaki
Committed by
Arnaud Fontaine
Mar 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_test_result: Make code compatible with both python2 and python3.
parent
9e6f61dd
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
16 deletions
+23
-16
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
...omponents/document.erp5.ERP5ProjectUnitTestDistributor.py
+3
-2
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ScalabilityDistributor.py
...al_components/document.erp5.ERP5ScalabilityDistributor.py
+2
-1
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.py
...em/portal_components/document.erp5.GitlabRESTConnector.py
+2
-2
bt5/erp5_test_result/ExtensionTemplateItem/portal_components/extension.erp5.ScalabilityTestSuiteUtils.py
...al_components/extension.erp5.ScalabilityTestSuiteUtils.py
+3
-2
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getDiff.py
...eItem/portal_skins/erp5_test_result/TestResult_getDiff.py
+2
-1
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJsonScalabilityStats.py
...ns/erp5_test_result/TestResult_getJsonScalabilityStats.py
+1
-1
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
...eItem/portal_components/test.erp5.testTaskDistribution.py
+6
-5
bt5/erp5_test_result/ToolComponentTemplateItem/portal_components/tool.erp5.TaskDistributionTool.py
...eItem/portal_components/tool.erp5.TaskDistributionTool.py
+3
-2
bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_suite_workflow/script_TestSuite_afterValidate.py
...low/test_suite_workflow/script_TestSuite_afterValidate.py
+1
-0
No files found.
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
View file @
35e1a629
...
@@ -32,6 +32,7 @@ from zLOG import LOG,DEBUG,ERROR
...
@@ -32,6 +32,7 @@ from zLOG import LOG,DEBUG,ERROR
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
six.moves
import
range
TEST_SUITE_MAX
=
4
TEST_SUITE_MAX
=
4
# Depending on the test suite priority, we will affect
# Depending on the test suite priority, we will affect
# more or less cores
# more or less cores
...
@@ -215,12 +216,12 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
...
@@ -215,12 +216,12 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# we divide per 3 because we have 3 cores per node
# we divide per 3 because we have 3 cores per node
node_quantity_min
=
PRIORITY_MAPPING
[
int_index
][
0
]
/
3
node_quantity_min
=
PRIORITY_MAPPING
[
int_index
][
0
]
/
3
node_quantity_max
=
PRIORITY_MAPPING
[
int_index
][
1
]
/
3
node_quantity_max
=
PRIORITY_MAPPING
[
int_index
][
1
]
/
3
for
x
in
x
range
(
0
,
node_quantity_min
):
for
x
in
range
(
0
,
node_quantity_min
):
score
=
float
(
x
)
/
(
x
+
1
)
score
=
float
(
x
)
/
(
x
+
1
)
all_test_suite_list
.
append
((
score
,
test_suite_url
,
title
))
all_test_suite_list
.
append
((
score
,
test_suite_url
,
title
))
test_suite_score
.
setdefault
(
test_suite_url
,
[]).
append
(
score
)
test_suite_score
.
setdefault
(
test_suite_url
,
[]).
append
(
score
)
# additional suites, lower score
# additional suites, lower score
for
x
in
x
range
(
0
,
node_quantity_max
-
for
x
in
range
(
0
,
node_quantity_max
-
node_quantity_min
):
node_quantity_min
):
score
=
float
(
1
)
+
x
/
(
x
+
1
)
score
=
float
(
1
)
+
x
/
(
x
+
1
)
all_test_suite_list
.
append
((
1
+
x
/
(
x
+
1
),
test_suite_url
,
title
))
all_test_suite_list
.
append
((
1
+
x
/
(
x
+
1
),
test_suite_url
,
title
))
...
...
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ScalabilityDistributor.py
View file @
35e1a629
...
@@ -33,6 +33,7 @@ from AccessControl import ClassSecurityInfo
...
@@ -33,6 +33,7 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
import
json
import
json
import
jinja2
import
jinja2
from
six.moves
import
range
class
ERP5ScalabilityDistributor
(
ERP5ProjectUnitTestDistributor
,
object
):
class
ERP5ScalabilityDistributor
(
ERP5ProjectUnitTestDistributor
,
object
):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
...
@@ -342,7 +343,7 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
...
@@ -342,7 +343,7 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
try
:
try
:
template
=
jinja2
.
Template
(
cluster_configuration
)
template
=
jinja2
.
Template
(
cluster_configuration
)
for
index
in
x
range
(
0
,
len
(
number_configuration_list
)):
for
index
in
range
(
0
,
len
(
number_configuration_list
)):
template_vars
=
{
"count"
:
number_configuration_list
[
index
],
template_vars
=
{
"count"
:
number_configuration_list
[
index
],
"comp"
:
remaining_nodes
}
"comp"
:
remaining_nodes
}
configuration_list_json
.
append
(
json
.
loads
(
configuration_list_json
.
append
(
json
.
loads
(
...
...
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.py
View file @
35e1a629
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
from
urllib
import
quote_plus
from
urllib
import
quote_plus
from
url
parse
import
urlparse
from
six.moves.urllib.
parse
import
urlparse
from
url
parse
import
urljoin
from
six.moves.urllib.
parse
import
urljoin
import
logging
import
logging
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
...
...
bt5/erp5_test_result/ExtensionTemplateItem/portal_components/extension.erp5.ScalabilityTestSuiteUtils.py
View file @
35e1a629
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
import
jinja2
import
jinja2
import
json
import
json
from
six.moves
import
range
def
getGeneratedConfigurationList
(
self
,
*
args
,
**
kw
):
def
getGeneratedConfigurationList
(
self
,
*
args
,
**
kw
):
document_list
=
[]
document_list
=
[]
...
@@ -36,7 +37,7 @@ def getGeneratedConfigurationList(self, *args, **kw):
...
@@ -36,7 +37,7 @@ def getGeneratedConfigurationList(self, *args, **kw):
#max = self.getNumberConfiguration()
#max = self.getNumberConfiguration()
comp_list_view
=
[
"COMP-%i"
%
(
x
)
for
x
in
range
(
0
,
max_comp
)
]
comp_list_view
=
[
"COMP-%i"
%
(
x
)
for
x
in
range
(
0
,
max_comp
)
]
for
count
in
x
range
(
1
,
max_
+
1
):
for
count
in
range
(
1
,
max_
+
1
):
template_vars
=
{
"count"
:
count
,
"comp"
:
comp_list_view
}
template_vars
=
{
"count"
:
count
,
"comp"
:
comp_list_view
}
output_text
=
template
.
render
(
template_vars
)
output_text
=
template
.
render
(
template_vars
)
description
=
json
.
dumps
(
json
.
loads
(
output_text
),
sort_keys
=
True
,
indent
=
4
,
separators
=
(
','
,
': '
))
description
=
json
.
dumps
(
json
.
loads
(
output_text
),
sort_keys
=
True
,
indent
=
4
,
separators
=
(
','
,
': '
))
...
@@ -126,7 +127,7 @@ def generateConfigurationList(self, test_suite_title):
...
@@ -126,7 +127,7 @@ def generateConfigurationList(self, test_suite_title):
# bad json configuration
# bad json configuration
try
:
try
:
template
=
jinja2
.
Template
(
cluster_configuration
)
template
=
jinja2
.
Template
(
cluster_configuration
)
for
count
in
x
range
(
1
,
number_configuration
+
1
):
for
count
in
range
(
1
,
number_configuration
+
1
):
template_vars
=
{
"count"
:
count
,
"comp"
:
remaining_nodes_computer_guid
}
template_vars
=
{
"count"
:
count
,
"comp"
:
remaining_nodes_computer_guid
}
configuration_list_json
.
append
(
json
.
loads
(
template
.
render
(
template_vars
)
)
)
configuration_list_json
.
append
(
json
.
loads
(
template
.
render
(
template_vars
)
)
)
return_dict
[
'launchable'
]
=
True
return_dict
[
'launchable'
]
=
True
...
...
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getDiff.py
View file @
35e1a629
...
@@ -9,6 +9,7 @@ if len(value_list) != 2:
...
@@ -9,6 +9,7 @@ if len(value_list) != 2:
a
,
b
=
value_list
a
,
b
=
value_list
from
Products.ERP5Type.Document
import
newTempBase
from
Products.ERP5Type.Document
import
newTempBase
import
six
# make sure that a is the oldest result
# make sure that a is the oldest result
if
a
.
getIntIndex
()
>
b
.
getIntIndex
():
if
a
.
getIntIndex
()
>
b
.
getIntIndex
():
...
@@ -50,7 +51,7 @@ for a_line in a.searchFolder(portal_type='Test Result Line'):
...
@@ -50,7 +51,7 @@ for a_line in a.searchFolder(portal_type='Test Result Line'):
before_url
=
a_line
.
absolute_url
(),
before_url
=
a_line
.
absolute_url
(),
**
d
))
**
d
))
for
title
,
not_in_a
in
b_title_dict
.
iteritems
(
):
for
title
,
not_in_a
in
six
.
iteritems
(
b_title_dict
):
b_line
=
b
[
not_in_a
]
b_line
=
b
[
not_in_a
]
d
=
dict
((
prop
,
b_line
.
getProperty
(
prop
))
for
prop
in
compared_prop_list
)
d
=
dict
((
prop
,
b_line
.
getProperty
(
prop
))
for
prop
in
compared_prop_list
)
object_list
.
append
(
newTempBase
(
context
,
title
,
object_list
.
append
(
newTempBase
(
context
,
title
,
...
...
bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJsonScalabilityStats.py
View file @
35e1a629
...
@@ -22,7 +22,7 @@ for tl in test_result_lines:
...
@@ -22,7 +22,7 @@ for tl in test_result_lines:
test_name
=
test
.
split
(
':'
)[
0
]
test_name
=
test
.
split
(
':'
)[
0
]
test_documents_created
=
test
.
split
(
':'
)[
1
].
replace
(
'doc/hour'
,
''
).
strip
()
test_documents_created
=
test
.
split
(
':'
)[
1
].
replace
(
'doc/hour'
,
''
).
strip
()
# initial init
# initial init
if
test_name
not
in
results
.
keys
(
):
if
test_name
not
in
list
(
results
.
keys
()
):
results
[
test_name
]
=
[]
results
[
test_name
]
=
[]
results
[
test_name
].
append
({
'created_docs'
:
test_documents_created
,
results
[
test_name
].
append
({
'created_docs'
:
test_documents_created
,
'duration'
:
3600
})
'duration'
:
3600
})
...
...
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
View file @
35e1a629
...
@@ -4,7 +4,8 @@ import json
...
@@ -4,7 +4,8 @@ import json
from
time
import
sleep
from
time
import
sleep
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
responses
import
responses
import
httplib
import
six.moves.http_client
from
six.moves
import
range
class
TaskDistributionTestCase
(
ERP5TypeTestCase
):
class
TaskDistributionTestCase
(
ERP5TypeTestCase
):
...
@@ -1348,7 +1349,7 @@ class TestTaskDistribution(TaskDistributionTestCase):
...
@@ -1348,7 +1349,7 @@ class TestTaskDistribution(TaskDistributionTestCase):
zope_partition_dict
+=
"{% endif %}
\
n
"
zope_partition_dict
+=
"{% endif %}
\
n
"
cluster_configuration
+=
zope_partition_dict
+
'
\
n
}}'
cluster_configuration
+=
zope_partition_dict
+
'
\
n
}}'
# -Generate graph coordinate
# -Generate graph coordinate
graph_coordinate
=
range
(
1
,
len
(
node_list
)
+
1
)
graph_coordinate
=
list
(
range
(
1
,
len
(
node_list
)
+
1
)
)
# -Create the test suite
# -Create the test suite
self
.
_createTestSuite
(
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
self
.
_createTestSuite
(
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
specialise_value
=
self
.
scalability_distributor
,
portal_type
=
"Scalability Test Suite"
,
specialise_value
=
self
.
scalability_distributor
,
portal_type
=
"Scalability Test Suite"
,
...
@@ -1675,7 +1676,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1675,7 +1676,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
self
.
assertEqual
(
self
.
assertEqual
(
self
.
id
(),
self
.
id
(),
body
[
'name'
])
body
[
'name'
])
return
(
httplib
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
return
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
return
_callback
return
_callback
def
test_start_test
(
self
):
def
test_start_test
(
self
):
...
@@ -1830,7 +1831,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1830,7 +1831,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
self
.
assertEqual
(
self
.
assertEqual
(
'https://erp5js.example.com/#%s'
%
self
.
test_result
.
getRelativeUrl
(),
'https://erp5js.example.com/#%s'
%
self
.
test_result
.
getRelativeUrl
(),
body
[
'target_url'
])
body
[
'target_url'
])
return
(
httplib
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
return
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
with
responses
.
RequestsMock
()
as
rsps
:
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add_callback
(
rsps
.
add_callback
(
...
@@ -1912,7 +1913,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1912,7 +1913,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
responses
.
POST
,
responses
.
POST
,
self
.
post_commit_status_url
,
self
.
post_commit_status_url
,
json
=
{
"message"
:
'Cannot transition status via :run from :running (Reason(s): Status cannot transition via "run")'
},
json
=
{
"message"
:
'Cannot transition status via :run from :running (Reason(s): Status cannot transition via "run")'
},
status
=
httplib
.
BAD_REQUEST
,
status
=
six
.
moves
.
http_client
.
BAD_REQUEST
,
)
)
self
.
test_result
.
start
()
self
.
test_result
.
start
()
self
.
tic
()
self
.
tic
()
bt5/erp5_test_result/ToolComponentTemplateItem/portal_components/tool.erp5.TaskDistributionTool.py
View file @
35e1a629
...
@@ -32,7 +32,8 @@ from Products.ERP5Type import Permissions
...
@@ -32,7 +32,8 @@ from Products.ERP5Type import Permissions
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
NegatedQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
NegatedQuery
from
zLOG
import
LOG
,
DEBUG
from
zLOG
import
LOG
,
DEBUG
from
xmlrpclib
import
Binary
from
six.moves.xmlrpc_client
import
Binary
import
six
class
TaskDistributionTool
(
BaseTool
):
class
TaskDistributionTool
(
BaseTool
):
"""
"""
...
@@ -266,7 +267,7 @@ class TaskDistributionTool(BaseTool):
...
@@ -266,7 +267,7 @@ class TaskDistributionTool(BaseTool):
extract all xmlrpclib.Binary instance
extract all xmlrpclib.Binary instance
"""
"""
return
{
x
:
y
.
data
if
isinstance
(
y
,
Binary
)
else
y
return
{
x
:
y
.
data
if
isinstance
(
y
,
Binary
)
else
y
for
x
,
y
in
xmlrpc_dict
.
iteritems
(
)}
for
x
,
y
in
six
.
iteritems
(
xmlrpc_dict
)}
security
.
declarePublic
(
'reportTaskFailure'
)
security
.
declarePublic
(
'reportTaskFailure'
)
def
reportTaskFailure
(
self
,
test_result_path
,
status_dict
,
node_title
):
def
reportTaskFailure
(
self
,
test_result_path
,
status_dict
,
node_title
):
...
...
bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_suite_workflow/script_TestSuite_afterValidate.py
View file @
35e1a629
import
string
import
string
from
random
import
choice
from
random
import
choice
from
six.moves
import
range
test_suite
=
state_change
[
'object'
]
test_suite
=
state_change
[
'object'
]
portal
=
test_suite
.
getPortalObject
()
portal
=
test_suite
.
getPortalObject
()
...
...
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