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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
26301342
Commit
26301342
authored
Jul 12, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
task distribution: improve unit test coverage and cosmetics improvements
parent
e4b06a5b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
18 deletions
+68
-18
bt5/erp5_test_result/TestTemplateItem/testTaskDistribution.py
...erp5_test_result/TestTemplateItem/testTaskDistribution.py
+63
-10
bt5/erp5_test_result/bt/revision
bt5/erp5_test_result/bt/revision
+1
-1
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
+4
-7
No files found.
bt5/erp5_test_result/TestTemplateItem/testTaskDistribution.py
View file @
26301342
...
...
@@ -68,12 +68,16 @@ class TestTaskDistribution(ERP5TypeTestCase):
return
test_node_list
def
_createTestSuite
(
self
,
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
specialise_value
=
None
):
specialise_value
=
None
,
title
=
None
):
if
title
is
None
:
title
=
""
if
specialise_value
is
None
:
specialise_value
=
self
.
distributor
test_suite_list
=
[]
for
i
in
range
(
quantity
):
test_suite_title
=
"test suite %i"
%
(
i
+
1
+
reference_correction
,)
test_suite_title
=
"test suite %i"
%
(
i
+
1
+
reference_correction
)
if
title
:
test_suite_title
+=
" %s"
%
title
test_suite
=
self
.
test_suite_module
.
newContent
(
title
=
test_suite_title
,
test_suite_title
=
test_suite_title
,
...
...
@@ -302,12 +306,13 @@ class TestTaskDistribution(ERP5TypeTestCase):
one test suite distributed per test node
"""
test_node_one
,
test_node_two
=
self
.
_createTestNode
(
quantity
=
2
)
test_suite_list
=
self
.
_createTestSuite
(
quantity
=
2
)
test_suite_one
=
self
.
_createTestSuite
(
reference_correction
=+
0
,
title
=
'one'
)[
0
]
test_suite_one_url
=
test_suite_one
.
getRelativeUrl
()
test_suite_two_url
=
self
.
_createTestSuite
(
reference_correction
=+
1
,
title
=
'two'
)[
0
].
getRelativeUrl
()
self
.
tic
()
self
.
_callOptimizeAlarm
()
test_suite_one
,
test_suite_two
=
test_suite_list
test_suite_one_url
,
test_suite_two_url
=
[
x
.
getRelativeUrl
()
for
x
in
test_suite_list
]
check
=
self
.
_checkTestSuiteAggregateList
check
([
test_node_one
,
[
test_suite_one_url
]],
[
test_node_two
,
[
test_suite_two_url
]])
...
...
@@ -322,7 +327,7 @@ class TestTaskDistribution(ERP5TypeTestCase):
check
([
test_node_zero
,
[]],
[
test_node_one
,
[]],
[
test_node_two
,
[
test_suite_two_url
]])
# test suite one is validat
ing
again, it is installed on first
# test suite one is validat
ed
again, it is installed on first
# available test node
test_suite_one
.
validate
()
check
([
test_node_zero
,
[
test_suite_one_url
]],
...
...
@@ -336,8 +341,8 @@ class TestTaskDistribution(ERP5TypeTestCase):
[
test_node_two
,
[]])
# we add another test suite, since all test node already have one
# test suite, the new test suite is given to first available one
test_suite_three_url
=
self
.
_createTestSuite
(
reference_correction
=+
2
)[
0
]
\
.
getRelativeUrl
()
test_suite_three_url
=
self
.
_createTestSuite
(
reference_correction
=+
2
,
title
=
'three'
)[
0
]
.
getRelativeUrl
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
]],
[
test_node_one
,
[
test_suite_two_url
]],
[
test_node_two
,
[]])
...
...
@@ -347,6 +352,52 @@ class TestTaskDistribution(ERP5TypeTestCase):
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
]],
[
test_node_one
,
[
test_suite_two_url
]],
[
test_node_two
,
[]])
# Now let's create a test suite needing between 1 to 2 test nodes
# We check that nodes with less suites are completed first
test_suite_four_url
=
self
.
_createTestSuite
(
reference_correction
=+
5
,
priority
=
4
,
title
=
'four'
)[
0
].
getRelativeUrl
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
]],
[
test_node_one
,
[
test_suite_two_url
,
test_suite_four_url
]],
[
test_node_two
,
[
test_suite_four_url
]])
# Now let's create a 2 test suite needing between 2 to 3 test nodes
# to make all test nodes almost satured
test_suite_five_url
=
self
.
_createTestSuite
(
reference_correction
=+
6
,
priority
=
7
,
title
=
'five'
)[
0
].
getRelativeUrl
()
test_suite_six_url
=
self
.
_createTestSuite
(
reference_correction
=+
7
,
priority
=
7
,
title
=
'six'
)[
0
].
getRelativeUrl
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_one
,
[
test_suite_two_url
,
test_suite_four_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_two
,
[
test_suite_four_url
,
test_suite_five_url
,
test_suite_six_url
]])
# Then, check what happens if all nodes are more than saturated
# with a test suite needing between 3 to 5 test nodes
test_suite_seven_url
=
self
.
_createTestSuite
(
reference_correction
=+
4
,
priority
=
9
,
title
=
'seven'
)[
0
].
getRelativeUrl
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_one
,
[
test_suite_two_url
,
test_suite_four_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_two
,
[
test_suite_four_url
,
test_suite_seven_url
,
test_suite_five_url
,
test_suite_six_url
]])
# No place any more, adding more test suite has no consequence
test_suite_height_url
=
self
.
_createTestSuite
(
reference_correction
=+
8
,
priority
=
9
,
title
=
'height'
)[
0
].
getRelativeUrl
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_one
,
[
test_suite_two_url
,
test_suite_four_url
,
test_suite_five_url
,
test_suite_six_url
]],
[
test_node_two
,
[
test_suite_four_url
,
test_suite_seven_url
,
test_suite_five_url
,
test_suite_six_url
]])
# free some place by removing a test suite
self
.
portal
.
unrestrictedTraverse
(
test_suite_five_url
).
invalidate
()
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_three_url
,
test_suite_six_url
,
test_suite_seven_url
]],
[
test_node_one
,
[
test_suite_two_url
,
test_suite_four_url
,
test_suite_six_url
,
test_suite_seven_url
]],
[
test_node_two
,
[
test_suite_four_url
,
test_suite_six_url
,
test_suite_seven_url
,
test_suite_height_url
]])
def
test_12_checkCloudPerformanceOptimizationIsStable
(
self
):
"""
...
...
@@ -389,7 +440,8 @@ class TestTaskDistribution(ERP5TypeTestCase):
check
([
test_node_zero
,
[
test_suite_one_url
,
test_suite_two_url
]],
[
test_node_one
,
[
test_suite_one_url
,
test_suite_two_url
]],
[
test_node_two
,
[
test_suite_one_url
,
test_suite_two_url
]])
# we add another test suite, all test nodes should run it
# we add another test suite, all test nodes should run it, except
# test_node_two which is dead
test_suite_three_url
=
self
.
_createTestSuite
(
reference_correction
=+
2
,
specialise_value
=
self
.
performance_distributor
)[
0
]
\
.
getRelativeUrl
()
...
...
@@ -406,6 +458,7 @@ class TestTaskDistribution(ERP5TypeTestCase):
test_suite_three_url
]],
[
test_node_two
,
[
test_suite_one_url
,
test_suite_two_url
,
test_suite_three_url
]])
# now we are going to
def
test_13_startTestSuiteWithOneTestNodeAndPerformanceDistributor
(
self
):
config_list
=
json
.
loads
(
self
.
performance_distributor
.
startTestSuite
(
...
...
bt5/erp5_test_result/bt/revision
View file @
26301342
241
\ No newline at end of file
243
\ No newline at end of file
product/ERP5/Document/ERP5ProjectUnitTestDistributor.py
View file @
26301342
...
...
@@ -99,11 +99,11 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
test_suite_list_to_remove
=
[]
for
test_node
in
test_node_list
:
test_suite_list
=
test_node
.
getAggregateList
()
for
test_suite
_title
in
test_suite_list
:
for
test_suite
in
test_suite_list
:
try
:
test_suite_list_to_add
.
remove
(
test_suite
_title
)
test_suite_list_to_add
.
remove
(
test_suite
)
except
ValueError
:
test_suite_list_to_remove
.
append
(
test_suite
_title
)
test_suite_list_to_remove
.
append
(
test_suite
)
return
test_suite_list_to_remove
security
.
declareProtected
(
Permissions
.
ManagePortal
,
"optimizeConfiguration"
)
...
...
@@ -207,10 +207,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
if
len
(
test_node_list
)
==
1
:
test_node
=
test_node_list
[
0
].
getObject
()
if
test_node
.
getValidationState
()
!=
'validated'
:
try
:
test_node
.
validate
()
except
e
:
LOG
(
'Test Node Validate'
,
ERROR
,
'%s'
%
e
)
if
test_node
is
None
:
test_node
=
test_node_module
.
newContent
(
portal_type
=
"Test Node"
,
title
=
title
,
specialise
=
self
.
getRelativeUrl
(),
...
...
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