Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
telecom
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
telecom
Commits
9302d0f7
Commit
9302d0f7
authored
May 15, 2018
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scalability: update in testsuite and tests
parent
86974665
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
51 deletions
+48
-51
scalability_test/__init__.py
scalability_test/__init__.py
+44
-25
scalability_test/example/createPerson.py
scalability_test/example/createPerson.py
+2
-24
scalability_test/example/createSaleOrder.py
scalability_test/example/createSaleOrder.py
+0
-0
scalability_test/example/scalabilityUsers.py
scalability_test/example/scalabilityUsers.py
+2
-2
No files found.
scalability_test/__init__.py
View file @
9302d0f7
import
os.path
import
json
import
urlparse
ZOPE_USER_FAMILY
=
"user"
ZOPE_ACTIVITIES_FAMILIY
=
"activities"
PERSON_KEY
=
"person_per_hour"
class
WendelinERP5_scalability
():
def
getTestList
(
self
):
return
[
'createPerson'
,
'createSaleOrder'
]
return
[
'createPerson'
]
def
getTestPath
(
self
):
return
'example
s
/'
return
'example/'
def
getUsersFilePath
(
self
):
return
'example
s
/scalabilityUsers'
return
'example/scalabilityUsers'
def
getUserQuantity
(
self
,
test_number
):
return
[
2
,
3
,
4
,
5
,
7
][
test_number
]
# for development (avoid create many users each try)
return
[
20
,
30
,
40
,
50
,
75
][
test_number
]
return
[
8
,
14
,
20
,
28
,
36
][
test_number
]
# Test duration in seconds
def
getTestDuration
(
self
,
test_number
):
return
40
*
self
.
getUserQuantity
(
test_number
)
return
60
*
10
def
getTestRepetition
(
self
,
test_number
):
return
3
def
getScalabilityTestUrl
(
self
,
instance_information_dict
):
erp5_address
=
instance_information_dict
[
"zope-address"
]
return
"http://%s/erp5"
%
erp5_address
for
frontend
in
instance_information_dict
[
'frontend-url-list'
]:
if
frontend
[
0
]
==
ZOPE_USER_FAMILY
:
frontend_address
=
frontend
[
1
]
break
port
=
4443
if
urlparse
.
urlparse
(
frontend_address
).
scheme
==
'https'
else
8080
return
"%s:%d/erp5"
%
(
frontend_address
,
port
)
def
getScalabilityTestMetricUrl
(
self
,
instance_information_dict
,
**
kw
):
metrics_url
=
"http://%s:%s@%s/erp5"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
],
instance_information_dict
[
'zope-address'
])
return
metrics_url
+
"/ERP5Site_getScalabilityTestMetric"
frontend_address
=
self
.
getScalabilityTestUrl
(
instance_information_dict
)
metrics_url
=
frontend_address
.
replace
(
"://"
,
"://%s:%s@"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
]))
return
metrics_url
+
"/TelecomSite_getScalabilityTestMetric"
def
getBootstrapScalabilityTestUrl
(
self
,
instance_information_dict
,
count
=
0
,
**
kw
):
frontend_address
=
self
.
getScalabilityTestUrl
(
instance_information_dict
)
bootstrap_url
=
frontend_address
.
replace
(
"://"
,
"://%s:%s@"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
]))
bootstrap_url
+=
"/TelecomSite_bootstrapScalabilityTest"
bootstrap_url
+=
"?user_quantity=%i"
%
self
.
getUserQuantity
(
count
)
return
bootstrap_url
def
getSiteAvailabilityUrl
(
self
,
instance_information_dict
,
**
kw
):
frontend_address
=
self
.
getScalabilityTestUrl
(
instance_information_dict
)
site_url
=
frontend_address
.
replace
(
"://"
,
"://%s:%s@"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
]))
return
site_url
+
"/TelecomSite_isReady"
def
getScalabilityTestOutput
(
self
,
metric_list
):
"""
From the list of metrics taken during a test run, select the best metric
for the test output by a specific criteria
"""
if
not
metric_list
:
return
None
output_json
=
json
.
loads
(
metric_list
[
0
])
for
metric
in
metric_list
:
metric_json
=
json
.
loads
(
metric
)
if
metric_json
[
"person_per_hour"
]
>
output_json
[
"person_per_hour"
]:
output_json
=
metric_json
return
"Person: %s doc/hour; SaleOrder: %s doc/hour;"
%
(
str
(
output_json
[
"person_per_hour"
]),
str
(
output_json
[
"sale_order_per_hour"
]))
def
getBootstrapScalabilityTestUrl
(
self
,
instance_information_dict
,
count
=
0
,
**
kw
):
bootstrap_url
=
"http://%s:%s@%s/erp5"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
],
instance_information_dict
[
'zope-address'
])
bootstrap_url
+=
"/ERP5Site_bootstrapScalabilityTest"
bootstrap_url
+=
"?user_quantity=%i"
%
self
.
getUserQuantity
(
count
)
return
bootstrap_url
if
metric_json
[
PERSON_KEY
]
>
output_json
[
PERSON_KEY
]:
output_json
[
PERSON_KEY
]
=
metric_json
[
PERSON_KEY
]
return
"Person: %s doc/hour"
%
str
(
output_json
[
PERSON_KEY
])
scalability_test/example
s
/createPerson.py
→
scalability_test/example/createPerson.py
View file @
9302d0f7
...
...
@@ -9,24 +9,7 @@ TMAX_SLEEP_LONG = 30
def
createPerson
(
result
,
browser
):
"""
Create a Person and add a telephone number. It can be ran infinitely (e.g.
until it is interrupted by the end user) with 1 concurrent user, through
performance_tester_erp5 with the following command:
performance_tester_erp5 http://foo.bar:4242/erp5/ 1 createPerson
Please note that you must run this command from the same directory of this
script and userInfo.py. Further information about performance_tester_erp5
options and arguments are available by specifying ``--help''.
This test requires the bt5 erp5_simulation_performance_test to be installed
for relation with organisation.
Also, in order to get more realistic results with concurrent users, random
sleep must be introduced to simulate a "real" user. This can be done through
'sleep' parameter (a tuple giving the minimum and maximum sleep time) to
open*() (Browser instance), submit*() (Form instance) and click*() (Link
instance).
Create a Person with some details.
"""
# Open ERP5 homepage
browser
.
open
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
...
...
@@ -49,11 +32,6 @@ def createPerson(result, browser):
browser
.
mainForm
.
getControl
(
name
=
'field_my_first_name'
).
value
=
'Create'
browser
.
mainForm
.
getControl
(
name
=
'field_my_last_name'
).
value
=
'Person'
# Link to organisation, this will add subobjects
# browser.mainForm.getControl(name='field_my_career_subordination_title').value = 'Supplier'
#browser.open("http://10.0.53.106:2200/erp5/person_module/9?portal_status_message=Object%20created.")#&editable_mode:int=1")
#browser.open("http://10.0.53.106:2200/erp5/person_module/9?portal_status_message=Data%20updated.")
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
...
...
@@ -74,4 +52,4 @@ def createPerson(result, browser):
result
(
'Waiting for validate_action'
,
waiting_for_validate_action
)
result
(
'Show validate'
,
show_validate_time
)
result
(
'Validated'
,
browser
.
mainForm
.
submitDialogConfirm
())
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
\ No newline at end of file
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
scalability_test/example
s
/createSaleOrder.py
→
scalability_test/example/createSaleOrder.py
View file @
9302d0f7
File moved
scalability_test/example
s
/scalabilityUsers.py
→
scalability_test/example/scalabilityUsers.py
View file @
9302d0f7
# Specify user login/password used to run the tests. Note that there must be
#
the same number of users specified here *and* on the script command-line.
#
<password> and <user_quantity> will be automatically replaced by testnode for each configuration
user_tuple
=
tuple
([(
'scalability_user_%i'
%
x
,
"<password>"
)
for
x
in
range
(
0
,
<
user_quantity
>
)])
\ No newline at end of file
user_tuple
=
tuple
([(
'scalability_user_%i'
%
x
,
"<password>"
)
for
x
in
range
(
0
,
<
user_quantity
>
)])
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