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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
18f66b3a
Commit
18f66b3a
authored
Mar 23, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_result: py3
parent
5d3b83ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
...omponents/document.erp5.ERP5ProjectUnitTestDistributor.py
+7
-6
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
...eItem/portal_components/test.erp5.testTaskDistribution.py
+3
-3
No files found.
bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.ERP5ProjectUnitTestDistributor.py
View file @
18f66b3a
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
from
__future__
import
division
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
json
import
json
...
@@ -214,17 +215,17 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
...
@@ -214,17 +215,17 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# suites required
# suites required
int_index
=
test_suite
.
getIntIndex
()
int_index
=
test_suite
.
getIntIndex
()
# 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
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
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
))
test_suite_score
.
setdefault
(
test_suite_url
,
[]).
append
(
score
)
test_suite_score
.
setdefault
(
test_suite_url
,
[]).
append
(
score
)
all_test_suite_list
.
sort
(
key
=
lambda
x
:
(
x
[
0
],
x
[
2
]))
all_test_suite_list
.
sort
(
key
=
lambda
x
:
(
x
[
0
],
x
[
2
]))
return
test_suite_score
,
[
x
[
1
]
for
x
in
all_test_suite_list
]
return
test_suite_score
,
[
x
[
1
]
for
x
in
all_test_suite_list
]
...
@@ -326,7 +327,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
...
@@ -326,7 +327,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# This allows to affect more test nodes to test suites with higher priority
# This allows to affect more test nodes to test suites with higher priority
wanted_test_core_quantity
=
PRIORITY_MAPPING
[
test_suite
.
getIntIndex
()][
1
]
wanted_test_core_quantity
=
PRIORITY_MAPPING
[
test_suite
.
getIntIndex
()][
1
]
factor
=
float
(
max_test_core_per_suite
)
/
wanted_test_core_quantity
factor
=
float
(
max_test_core_per_suite
)
/
wanted_test_core_quantity
missing_quantity
=
wanted_test_core_quantity
/
3
-
len
(
test_result
.
objectValues
(
portal_type
=
"Test Result Node"
))
missing_quantity
=
wanted_test_core_quantity
//
3
-
len
(
test_result
.
objectValues
(
portal_type
=
"Test Result Node"
))
key
=
(
max_test_core_per_suite
-
missing_quantity
*
3
*
factor
,
modification_date
)
key
=
(
max_test_core_per_suite
-
missing_quantity
*
3
*
factor
,
modification_date
)
else
:
else
:
key
=
(
0
,
random
.
random
())
key
=
(
0
,
random
.
random
())
...
...
bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py
View file @
18f66b3a
...
@@ -1676,7 +1676,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1676,7 +1676,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
self
.
assertEqual
(
self
.
assertEqual
(
self
.
id
(),
self
.
id
(),
body
[
'name'
])
body
[
'name'
])
return
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
return
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
b
'{}'
)
return
_callback
return
_callback
def
test_start_test
(
self
):
def
test_start_test
(
self
):
...
@@ -1693,7 +1693,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1693,7 +1693,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
rsps
.
add
(
rsps
.
add
(
responses
.
POST
,
responses
.
POST
,
self
.
post_commit_status_url
,
self
.
post_commit_status_url
,
{}
)
b'{}'
)
self
.
test_result
.
start
()
self
.
test_result
.
start
()
self
.
tic
()
self
.
tic
()
...
@@ -1831,7 +1831,7 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
...
@@ -1831,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
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
'{}'
)
return
(
six
.
moves
.
http_client
.
CREATED
,
{
'content-type'
:
'application/json'
},
b
'{}'
)
with
responses
.
RequestsMock
()
as
rsps
:
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add_callback
(
rsps
.
add_callback
(
...
...
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