Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
77763bcf
Commit
77763bcf
authored
Aug 22, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_test_result: update ERP5Scalabilitydistributor and add tests
parent
3026d87e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
283 additions
and
68 deletions
+283
-68
bt5/erp5_test_result/DocumentTemplateItem/ERP5ScalabilityDistributor.py
...result/DocumentTemplateItem/ERP5ScalabilityDistributor.py
+5
-62
bt5/erp5_test_result/TestTemplateItem/testTaskDistribution.py
...erp5_test_result/TestTemplateItem/testTaskDistribution.py
+277
-5
bt5/erp5_test_result/bt/revision
bt5/erp5_test_result/bt/revision
+1
-1
No files found.
bt5/erp5_test_result/DocumentTemplateItem/ERP5ScalabilityDistributor.py
View file @
77763bcf
...
@@ -57,13 +57,8 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -57,13 +57,8 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
# Get lists of test node wich belong to the current distributor
# Get lists of test node wich belong to the current distributor
all_test_node_list
=
test_node_module
.
searchFolder
(
all_test_node_list
=
test_node_module
.
searchFolder
(
portal_type
=
"Test Node"
,
specialise_uid
=
self
.
getUid
())
portal_type
=
"Test Node"
,
specialise_uid
=
self
.
getUid
())
test_node_list
=
[
x
.
getObject
()
for
x
in
all_test_node_list
if
x
.
validationState
()
==
'validated'
]
test_node_list
=
[
x
.
getObject
()
for
x
in
all_test_node_list
if
x
.
getValidationState
()
==
'validated'
]
invalid_test_node_list
=
[
x
.
getObject
()
for
x
in
all_test_node_list
if
x
.
validationState
()
!=
'validated'
]
invalid_test_node_list
=
[
x
.
getObject
()
for
x
in
all_test_node_list
if
x
.
getValidationState
()
!=
'validated'
]
log
(
"test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
test_node_list
])
log
(
"invalid_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
invalid_test_node_list
])
# Set master property to False for all invalid testnode
# Set master property to False for all invalid testnode
for
node
in
invalid_test_node_list
:
for
node
in
invalid_test_node_list
:
...
@@ -73,17 +68,9 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -73,17 +68,9 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
slave_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
!=
True
]
slave_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
!=
True
]
master_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
==
True
]
master_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
==
True
]
# Set to 'False' slaves
log
(
"---2--"
)
for
node
in
slave_test_node_list
:
log
(
"test_node_list:"
)
node
.
setMaster
(
False
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
test_node_list
])
log
(
"invalid_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
invalid_test_node_list
])
log
(
"slave_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
slave_test_node_list
])
log
(
"master_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
master_test_node_list
])
# if there is validated testnodes
# if there is validated testnodes
if
len
(
test_node_list
)
>
0
:
if
len
(
test_node_list
)
>
0
:
...
@@ -102,16 +89,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -102,16 +89,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
slave_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
!=
True
]
slave_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
!=
True
]
master_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
==
True
]
master_test_node_list
=
[
x
.
getObject
()
for
x
in
test_node_list
if
x
.
getMaster
()
==
True
]
log
(
"---3--"
)
log
(
"test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
test_node_list
])
log
(
"invalid_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
invalid_test_node_list
])
log
(
"slave_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
slave_test_node_list
])
log
(
"master_test_node_list:"
)
log
([(
x
.
getTitle
(),
x
.
getMaster
())
for
x
in
master_test_node_list
])
# Get test suites and aggregate them to all valid testnode
# Get test suites and aggregate them to all valid testnode
test_suite_list
=
[
x
.
getTitle
()
for
x
in
test_suite_module
.
searchFolder
(
test_suite_list
=
[
x
.
getTitle
()
for
x
in
test_suite_module
.
searchFolder
(
portal_type
=
"Scalability Test Suite"
,
portal_type
=
"Scalability Test Suite"
,
...
@@ -119,8 +96,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -119,8 +96,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
for
test_node
in
test_node_list
:
for
test_node
in
test_node_list
:
test_node
.
setAggregateList
(
test_suite_list
)
test_node
.
setAggregateList
(
test_suite_list
)
security
.
declarePublic
(
"getInvolvedNodeList"
)
security
.
declarePublic
(
"getInvolvedNodeList"
)
def
getInvolvedNodeList
(
self
):
def
getInvolvedNodeList
(
self
):
"""
"""
...
@@ -132,36 +107,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -132,36 +107,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
involved_nodes
=
involved_nodes
+
[
x
.
getObject
()
for
x
in
test_node_module
.
searchFolder
(
validation_state
=
'validated'
)
if
(
x
.
getSpecialiseTitle
()
==
distributor_title
)
]
involved_nodes
=
involved_nodes
+
[
x
.
getObject
()
for
x
in
test_node_module
.
searchFolder
(
validation_state
=
'validated'
)
if
(
x
.
getSpecialiseTitle
()
==
distributor_title
)
]
return
involved_nodes
return
involved_nodes
security
.
declarePublic
(
"subscribeNode"
)
def
subscribeNode
(
self
,
title
,
computer_guid
,
batch_mode
=
0
):
"""
subscribeNode doc
"""
test_node_module
=
self
.
_getTestNodeModule
()
portal
=
self
.
getPortalObject
()
tag
=
"%s_%s"
%
(
self
.
getRelativeUrl
(),
title
)
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
==
0
:
test_node_list
=
test_node_module
.
searchFolder
(
portal_type
=
"Test Node"
,
title
=
title
)
assert
len
(
test_node_list
)
in
(
0
,
1
),
"Unable to find testnode : %s"
%
title
test_node
=
None
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
,
computer_guid
=
computer_guid
,
specialise
=
self
.
getRelativeUrl
(),
activate_kw
=
{
'tag'
:
tag
})
self
.
activate
(
after_tag
=
tag
).
optimizeConfiguration
()
test_node
.
setPingDate
()
return
test_node
return
None
security
.
declarePublic
(
"getTestNode"
)
security
.
declarePublic
(
"getTestNode"
)
def
getTestNode
(
self
,
title
,
batch_mode
=
0
):
def
getTestNode
(
self
,
title
,
batch_mode
=
0
):
"""
"""
...
@@ -201,7 +146,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -201,7 +146,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
else
:
else
:
return
False
return
False
security
.
declarePublic
(
"getTestType"
)
security
.
declarePublic
(
"getTestType"
)
def
getTestType
(
self
,
batch_mode
=
0
):
def
getTestType
(
self
,
batch_mode
=
0
):
"""
"""
...
@@ -209,7 +153,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
...
@@ -209,7 +153,6 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
"""
"""
return
'ScalabilityTest'
return
'ScalabilityTest'
security
.
declarePublic
(
"startTestSuite"
)
security
.
declarePublic
(
"startTestSuite"
)
def
startTestSuite
(
self
,
title
,
batch_mode
=
0
):
def
startTestSuite
(
self
,
title
,
batch_mode
=
0
):
"""
"""
...
...
bt5/erp5_test_result/TestTemplateItem/testTaskDistribution.py
View file @
77763bcf
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
zLOG
import
LOG
,
INFO
,
ERROR
from
zLOG
import
LOG
,
INFO
,
ERROR
from
Products.ERP5.Document.ERP5ProjectUnitTestDistributor
import
\
ERP5ProjectUnitTestDistributor
import
json
import
json
from
Products.ERP5Type.Log
import
log
class
TestTaskDistribution
(
ERP5TypeTestCase
):
class
TestTaskDistribution
(
ERP5TypeTestCase
):
...
@@ -23,8 +22,12 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -23,8 +22,12 @@ class TestTaskDistribution(ERP5TypeTestCase):
if
getattr
(
tool
,
"TestPerformanceTaskDistribution"
,
None
)
is
None
:
if
getattr
(
tool
,
"TestPerformanceTaskDistribution"
,
None
)
is
None
:
tool
.
newContent
(
id
=
"TestPerformanceTaskDistribution"
,
tool
.
newContent
(
id
=
"TestPerformanceTaskDistribution"
,
portal_type
=
"Cloud Performance Unit Test Distributor"
)
portal_type
=
"Cloud Performance Unit Test Distributor"
)
if
getattr
(
tool
,
"TestScalabilityTaskDistribution"
,
None
)
is
None
:
tool
.
newContent
(
id
=
"TestScalabilityTaskDistribution"
,
portal_type
=
"ERP5 Scalability Distributor"
)
self
.
distributor
=
tool
.
TestTaskDistribution
self
.
distributor
=
tool
.
TestTaskDistribution
self
.
performance_distributor
=
tool
.
TestPerformanceTaskDistribution
self
.
performance_distributor
=
tool
.
TestPerformanceTaskDistribution
self
.
scalability_distributor
=
tool
.
TestScalabilityTaskDistribution
if
getattr
(
portal
,
"test_test_node_module"
,
None
)
is
None
:
if
getattr
(
portal
,
"test_test_node_module"
,
None
)
is
None
:
portal
.
newContent
(
portal_type
=
"Test Node Module"
,
portal
.
newContent
(
portal_type
=
"Test Node Module"
,
id
=
"test_test_node_module"
)
id
=
"test_test_node_module"
)
...
@@ -37,21 +40,40 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -37,21 +40,40 @@ class TestTaskDistribution(ERP5TypeTestCase):
x
for
x
in
self
.
test_suite_module
.
objectIds
()])
x
for
x
in
self
.
test_suite_module
.
objectIds
()])
self
.
test_node_module
.
manage_delObjects
(
ids
=
[
self
.
test_node_module
.
manage_delObjects
(
ids
=
[
x
for
x
in
self
.
test_node_module
.
objectIds
()])
x
for
x
in
self
.
test_node_module
.
objectIds
()])
original_class
=
ERP5ProjectUnitTestDistributor
original_class
=
self
.
distributor
.
__class__
original_scalability_class
=
self
.
scalability_distributor
.
__class__
original_performance_class
=
self
.
performance_distributor
.
__class__
self
.
_original_getTestNodeModule
=
original_class
.
_getTestNodeModule
self
.
_original_getTestNodeModule
=
original_class
.
_getTestNodeModule
def
_getTestNodeModule
(
self
):
def
_getTestNodeModule
(
self
):
return
self
.
getPortalObject
().
test_test_node_module
return
self
.
getPortalObject
().
test_test_node_module
original_class
.
_getTestNodeModule
=
_getTestNodeModule
original_class
.
_getTestNodeModule
=
_getTestNodeModule
original_scalability_class
.
_getTestNodeModule
=
_getTestNodeModule
original_performance_class
.
_getTestNodeModule
=
_getTestNodeModule
self
.
_original_getTestSuiteModule
=
original_class
.
_getTestSuiteModule
self
.
_original_getTestSuiteModule
=
original_class
.
_getTestSuiteModule
def
_getTestSuiteModule
(
self
):
def
_getTestSuiteModule
(
self
):
return
self
.
getPortalObject
().
test_test_suite_module
return
self
.
getPortalObject
().
test_test_suite_module
original_class
.
_getTestSuiteModule
=
_getTestSuiteModule
original_class
.
_getTestSuiteModule
=
_getTestSuiteModule
original_scalability_class
.
_getTestSuiteModule
=
_getTestSuiteModule
original_performance_class
.
_getTestSuiteModule
=
_getTestSuiteModule
self
.
_cleanupTestResult
()
self
.
_cleanupTestResult
()
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
original_class
=
ERP5ProjectUnitTestDistributor
original_class
=
self
.
distributor
.
__class__
original_scalability_class
=
self
.
scalability_distributor
.
__class__
original_performance_class
=
self
.
performance_distributor
.
__class__
original_class
.
_getTestNodeModule
=
self
.
_original_getTestNodeModule
original_class
.
_getTestNodeModule
=
self
.
_original_getTestNodeModule
original_class
.
_getTestSuiteModule
=
self
.
_original_getTestSuiteModule
original_class
.
_getTestSuiteModule
=
self
.
_original_getTestSuiteModule
original_scalability_class
.
_getTestNodeModule
=
self
.
_original_getTestNodeModule
original_scalability_class
.
_getTestSuiteModule
=
self
.
_original_getTestSuiteModule
original_performance_class
.
_getTestNodeModule
=
self
.
_original_getTestNodeModule
original_performance_class
.
_getTestSuiteModule
=
self
.
_original_getTestSuiteModule
def
_createTestNode
(
self
,
quantity
=
1
,
reference_correction
=
0
,
def
_createTestNode
(
self
,
quantity
=
1
,
reference_correction
=
0
,
specialise_value
=
None
):
specialise_value
=
None
):
...
@@ -68,7 +90,8 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -68,7 +90,8 @@ class TestTaskDistribution(ERP5TypeTestCase):
return
test_node_list
return
test_node_list
def
_createTestSuite
(
self
,
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
def
_createTestSuite
(
self
,
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
specialise_value
=
None
,
title
=
None
):
specialise_value
=
None
,
title
=
None
,
portal_type
=
"Test Suite"
,
graph_coordinate
=
"1"
,
cluster_configuration
=
'{ "test": {{ count }} }'
):
if
title
is
None
:
if
title
is
None
:
title
=
""
title
=
""
if
specialise_value
is
None
:
if
specialise_value
is
None
:
...
@@ -78,13 +101,20 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -78,13 +101,20 @@ class TestTaskDistribution(ERP5TypeTestCase):
test_suite_title
=
"test suite %i"
%
(
i
+
1
+
reference_correction
)
test_suite_title
=
"test suite %i"
%
(
i
+
1
+
reference_correction
)
if
title
:
if
title
:
test_suite_title
+=
" %s"
%
title
test_suite_title
+=
" %s"
%
title
test_suite
=
self
.
test_suite_module
.
newContent
(
test_suite
=
self
.
test_suite_module
.
newContent
(
portal_type
=
portal_type
,
title
=
test_suite_title
,
title
=
test_suite_title
,
test_suite_title
=
test_suite_title
,
test_suite_title
=
test_suite_title
,
test_suite
=
'B%i'
%
i
,
test_suite
=
'B%i'
%
i
,
int_index
=
priority
,
int_index
=
priority
,
specialise_value
=
specialise_value
,
specialise_value
=
specialise_value
,
)
)
if
portal_type
==
"Scalability Test Suite"
:
test_suite
.
setGraphCoordinate
(
graph_coordinate
)
test_suite
.
setClusterConfiguration
(
cluster_configuration
)
test_suite
.
newContent
(
portal_type
=
'Test Suite Repository'
,
test_suite
.
newContent
(
portal_type
=
'Test Suite Repository'
,
branch
=
'master'
,
branch
=
'master'
,
git_url
=
'http://git.erp5.org/repos/erp5.git'
,
git_url
=
'http://git.erp5.org/repos/erp5.git'
,
...
@@ -100,8 +130,20 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -100,8 +130,20 @@ class TestTaskDistribution(ERP5TypeTestCase):
self
.
assertEquals
(
test_node
.
getPortalType
(),
"Test Node"
)
self
.
assertEquals
(
test_node
.
getPortalType
(),
"Test Node"
)
def
test_02_createTestSuite
(
self
):
def
test_02_createTestSuite
(
self
):
# Test Test Suite
test_suite
,
=
self
.
_createTestSuite
()
test_suite
,
=
self
.
_createTestSuite
()
self
.
assertEquals
(
test_suite
.
getPortalType
(),
"Test Suite"
)
self
.
assertEquals
(
test_suite
.
getPortalType
(),
"Test Suite"
)
self
.
assertEquals
(
test_suite
.
getSpecialise
(),
self
.
distributor
.
getRelativeUrl
())
# Test Scalability Test Suite
scalability_test_suite
,
=
self
.
_createTestSuite
(
portal_type
=
"Scalability Test Suite"
,
specialise_value
=
self
.
scalability_distributor
)
self
.
assertEquals
(
scalability_test_suite
.
getPortalType
(),
"Scalability Test Suite"
)
self
.
assertEquals
(
scalability_test_suite
.
getSpecialise
(),
self
.
scalability_distributor
.
getRelativeUrl
())
def
_callOptimizeAlarm
(
self
):
def
_callOptimizeAlarm
(
self
):
self
.
portal
.
portal_alarms
.
task_distributor_alarm_optimize
.
activeSense
()
self
.
portal
.
portal_alarms
.
task_distributor_alarm_optimize
.
activeSense
()
...
@@ -474,3 +516,233 @@ class TestTaskDistribution(ERP5TypeTestCase):
...
@@ -474,3 +516,233 @@ class TestTaskDistribution(ERP5TypeTestCase):
self
.
assertEquals
(
set
([
'test suite 1-COMP32-Node1'
,
self
.
assertEquals
(
set
([
'test suite 1-COMP32-Node1'
,
'test suite 2-COMP32-Node1'
]),
'test suite 2-COMP32-Node1'
]),
set
([
x
[
'test_suite_title'
]
for
x
in
config_list
]))
set
([
x
[
'test_suite_title'
]
for
x
in
config_list
]))
def
test_14_subscribeNodeCheckERP5ScalabilityDistributor
(
self
):
"""
Check test node subscription.
"""
test_node_module
=
self
.
test_node_module
# Generate informations for nodes to subscribe
nodes
=
dict
([(
"COMP%d-Scalability-Node_test14"
%
i
,
"COMP-%d"
%
i
)
for
i
in
range
(
0
,
5
)])
# Subscribe nodes
for
node_title
in
nodes
.
keys
():
self
.
scalability_distributor
.
subscribeNode
(
node_title
,
computer_guid
=
nodes
[
node_title
])
self
.
tic
()
# Get validated test nodes
test_nodes
=
test_node_module
.
searchFolder
(
validation_state
=
'validated'
)
# Get test node title list
test_node_titles
=
[
x
.
getTitle
()
for
x
in
test_nodes
]
# Check subscription
for
node_title
in
nodes
.
keys
():
self
.
assertTrue
(
node_title
in
test_node_titles
)
# Check ping date
# TODO..
def
test_15_optimizeConfigurationCheckElectionERP5ScalabilityDistributor
(
self
):
"""
Check optimizeConfiguration method of scalability distributor.
- Check the master election
"""
test_node_module
=
self
.
test_node_module
## 1 (check election, classic)
# Subscribe nodes
self
.
scalability_distributor
.
subscribeNode
(
"COMP1-Scalability-Node1"
,
computer_guid
=
"COMP-1"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP2-Scalability-Node2"
,
computer_guid
=
"COMP-2"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP3-Scalability-Node3"
,
computer_guid
=
"COMP-3"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP4-Scalability-Node4"
,
computer_guid
=
"COMP-4"
)
self
.
tic
()
# Check test node election
def
getMasterAndSlaveNodeList
():
"""
Optimize the configuration and return which nodes are master/slave
"""
self
.
_callOptimizeAlarm
()
master_test_node_list
=
[
x
for
x
in
test_node_module
.
searchFolder
()
\
if
(
x
.
getMaster
()
==
True
and
x
.
getValidationState
()
==
'validated'
)]
slave_test_node_list
=
[
x
for
x
in
test_node_module
.
searchFolder
()
\
if
(
x
.
getMaster
()
==
False
and
x
.
getValidationState
()
==
'validated'
)]
return
master_test_node_list
,
slave_test_node_list
master_test_node_list
,
slave_test_node_list
=
getMasterAndSlaveNodeList
()
# -Only one master must be elected
self
.
assertEquals
(
1
,
len
(
master_test_node_list
))
# -Others test node must not be the matser
self
.
assertEquals
(
3
,
len
(
slave_test_node_list
))
# Get the current master test node
current_master_test_node_1
=
master_test_node_list
[
0
]
## 2 (check election, with adding new nodes)
# Add new nodes
self
.
scalability_distributor
.
subscribeNode
(
"COMP5-Scalability-Node5"
,
computer_guid
=
"COMP-5"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP6-Scalability-Node6"
,
computer_guid
=
"COMP-6"
)
self
.
tic
()
# Check test node election
master_test_node_list
,
slave_test_node_list
=
getMasterAndSlaveNodeList
()
# -Only one master must be elected
self
.
assertEquals
(
1
,
len
(
master_test_node_list
))
# -Others test node must not be the matser
self
.
assertEquals
(
5
,
len
(
slave_test_node_list
))
# Get the current master test node
current_master_test_node_2
=
master_test_node_list
[
0
]
# Master test node while he is alive
self
.
assertEquals
(
current_master_test_node_1
.
getTitle
(),
current_master_test_node_2
.
getTitle
())
## 3 (check election, with master deletion)
# Invalidate master
current_master_test_node_2
.
invalidate
()
# Check test node election
master_test_node_list
,
slave_test_node_list
=
getMasterAndSlaveNodeList
()
# -Only one master must be elected
self
.
assertEquals
(
1
,
len
(
master_test_node_list
))
# -Others test node must not be the matser
self
.
assertEquals
(
4
,
len
(
slave_test_node_list
))
# Get the current master test node
current_master_test_node_3
=
master_test_node_list
[
0
]
# Master test node must be an other test node than previously
self
.
assertNotEquals
(
current_master_test_node_2
.
getTitle
(),
current_master_test_node_3
.
getTitle
())
def
test_16_startTestSuiteERP5ScalabilityDistributor
(
self
):
"""
Check test suite getting, for the scalability case only the master
test node receive test suite.
"""
test_node_module
=
self
.
test_node_module
# Subscribe nodes
nodes
=
[
self
.
scalability_distributor
.
subscribeNode
(
"COMP1-Scalability-Node1"
,
computer_guid
=
"COMP-1"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP2-Scalability-Node2"
,
computer_guid
=
"COMP-2"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP3-Scalability-Node3"
,
computer_guid
=
"COMP-3"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP4-Scalability-Node4"
,
computer_guid
=
"COMP-4"
)]
# Create test suite
test_suite
=
self
.
_createTestSuite
(
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
specialise_value
=
self
.
scalability_distributor
,
portal_type
=
"Scalability Test Suite"
)
self
.
tic
()
self
.
_callOptimizeAlarm
()
# Get current master test node
master_test_nodes
=
[
x
for
x
in
test_node_module
.
searchFolder
()
\
if
(
x
.
getMaster
()
==
True
and
x
.
getValidationState
()
==
"validated"
)]
current_master_test_node
=
master_test_nodes
[
0
]
self
.
tic
()
# Each node run startTestSuite
config_nodes
=
{
'COMP1-Scalability-Node1'
:
json
.
loads
(
self
.
scalability_distributor
.
startTestSuite
(
title
=
"COMP1-Scalability-Node1"
)),
'COMP2-Scalability-Node2'
:
json
.
loads
(
self
.
scalability_distributor
.
startTestSuite
(
title
=
"COMP2-Scalability-Node2"
)),
'COMP3-Scalability-Node3'
:
json
.
loads
(
self
.
scalability_distributor
.
startTestSuite
(
title
=
"COMP3-Scalability-Node3"
)),
'COMP4-Scalability-Node4'
:
json
.
loads
(
self
.
scalability_distributor
.
startTestSuite
(
title
=
"COMP4-Scalability-Node4"
))
}
# Check if master has got a non empty configuration
self
.
assertNotEquals
(
config_nodes
[
current_master_test_node
.
getTitle
()],
[])
# -Delete master test node suite from dict
del
config_nodes
[
current_master_test_node
.
getTitle
()]
# Check if slave test node have got empty list
for
suite
in
config_nodes
.
values
():
self
.
assertEquals
(
suite
,
[])
def
test_17_isMasterTestnodeERP5ScalabilityDistributor
(
self
):
"""
Check the method isMasterTestnode()
"""
test_node_module
=
self
.
test_node_module
# Subscribe nodes
self
.
scalability_distributor
.
subscribeNode
(
"COMP1-Scalability-Node1"
,
computer_guid
=
"COMP-1"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP2-Scalability-Node2"
,
computer_guid
=
"COMP-2"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP3-Scalability-Node3"
,
computer_guid
=
"COMP-3"
)
self
.
scalability_distributor
.
subscribeNode
(
"COMP4-Scalability-Node4"
,
computer_guid
=
"COMP-4"
)
self
.
tic
()
self
.
_callOptimizeAlarm
()
# Optimize configuration
self
.
scalability_distributor
.
optimizeConfiguration
()
self
.
tic
()
# Get test nodes
master_test_nodes
=
[
x
for
x
in
test_node_module
.
searchFolder
()
if
(
x
.
getMaster
()
==
True
and
x
.
getValidationState
()
==
'validated'
)]
slave_test_nodes
=
[
x
for
x
in
test_node_module
.
searchFolder
()
if
(
x
.
getMaster
()
==
False
and
x
.
getValidationState
()
==
'validated'
)]
# Check isMasterTestnode method
for
master
in
master_test_nodes
:
self
.
assertTrue
(
self
.
scalability_distributor
.
isMasterTestnode
(
master
.
getTitle
()))
for
slave
in
slave_test_nodes
:
self
.
assertTrue
(
not
self
.
scalability_distributor
.
isMasterTestnode
(
slave
.
getTitle
()))
def
test_18_checkConfigurationGenerationERP5ScalabilityDistributor
(
self
):
"""
Check configuration generation
"""
test_node_module
=
self
.
test_node_module
# Subscribe nodes
node_list
=
[
self
.
scalability_distributor
.
subscribeNode
(
"COMP1-Scalability-Node1"
,
computer_guid
=
"COMP-1"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP2-Scalability-Node2"
,
computer_guid
=
"COMP-2"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP3-Scalability-Node3"
,
computer_guid
=
"COMP-3"
),
self
.
scalability_distributor
.
subscribeNode
(
"COMP4-Scalability-Node4"
,
computer_guid
=
"COMP-4"
)]
self
.
tic
()
self
.
_callOptimizeAlarm
()
#
def
generateZopePartitionDict
(
i
):
"""
Generate a configuration wich uses jinja2
"""
partition_dict
=
""
for
j
in
range
(
0
,
i
):
family_name
=
[
'user'
,
'activity'
][
j
%
2
]
partition_dict
+=
'"%s-%s":{
\
n
'
%
(
family_name
,
node_list
[
j
].
getReference
())
partition_dict
+=
' "instance-count": {{ count }},
\
n
'
partition_dict
+=
' "family": "%s",
\
n
'
%
family_name
partition_dict
+=
' "computer_guid": "%s"
\
n
'
%
node_list
[
j
].
getReference
()
partition_dict
+=
'}'
if
j
!=
i
-
1
:
partition_dict
+=
',
\
n
'
else
:
partition_dict
+=
'
\
n
'
return
partition_dict
# Generate a test suite
# -Generate a configuration adapted to the test node list length
cluster_configuration
=
'{"zope-partition-dict":{
\
n
'
zope_partition_dict
=
""
for
i
in
range
(
1
,
len
(
node_list
)
+
1
):
zope_partition_dict
+=
"{%% if count == %d %%}
\
n
"
%
i
zope_partition_dict
+=
generateZopePartitionDict
(
i
)
zope_partition_dict
+=
"{% endif %}
\
n
"
cluster_configuration
+=
zope_partition_dict
+
'
\
n
}}'
# -Generate graph coordinate
graph_coordinate
=
range
(
1
,
len
(
node_list
)
+
1
)
# -Create the test suite
test_suite
=
self
.
_createTestSuite
(
quantity
=
1
,
priority
=
1
,
reference_correction
=
0
,
specialise_value
=
self
.
scalability_distributor
,
portal_type
=
"Scalability Test Suite"
,
graph_coordinate
=
graph_coordinate
,
cluster_configuration
=
cluster_configuration
)
self
.
tic
()
# Master test node launch startTestSuite
for
node
in
node_list
:
if
node
.
getMaster
():
test_suite_title
=
self
.
scalability_distributor
.
startTestSuite
(
title
=
node
.
getTitle
())
# log("test_suite_title: %s" %test_suite_title)
break
# Get configuration list generated from test suite
# configuration_list = self.scalability_distributor.generateConfiguration(test_suite_title)
# logs
# log(configuration_list)
def
test_19_testMultiDistributor
(
self
):
pass
bt5/erp5_test_result/bt/revision
View file @
77763bcf
263
264
\ No newline at end of file
\ No newline at end of file
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