Commit 9302d0f7 authored by Roque's avatar Roque

scalability: update in testsuite and tests

parent 86974665
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 'examples/'
return 'example/'
def getUsersFilePath(self):
return 'examples/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])
......@@ -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.'
# 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>)])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment