Commit 2d4eaa1f authored by Roque's avatar Roque

scalability: test suite refactor

parent f2337e33
import os.path import os.path
import json import json
import urlparse
ZOPE_USER_FAMILY = "user"
ZOPE_ACTIVITIES_FAMILIY = "activities"
PERSON_KEY = "person_per_hour" PERSON_KEY = "person_per_hour"
ORDER_KEY = "sale_order_per_hour" ORDER_KEY = "sale_order_per_hour"
...@@ -16,23 +19,32 @@ class ERP5_scalability(): ...@@ -16,23 +19,32 @@ class ERP5_scalability():
return 'example/scalabilityUsers' return 'example/scalabilityUsers'
def getUserQuantity(self, test_number): def getUserQuantity(self, test_number):
return [20, 30, 40, 50, 60][test_number] return [8, 14, 20, 28, 36][test_number]
# Test duration in seconds # Test duration in seconds
def getTestDuration(self, test_number): def getTestDuration(self, test_number):
return 8*self.getUserQuantity(test_number) return 30 * self.getUserQuantity(test_number)
def getTestRepetition(self, test_number): def getTestRepetition(self, test_number):
return 3 return 3
def getScalabilityTestUrl(self, instance_information_dict): def getScalabilityTestUrl(self, instance_information_dict):
frontend_address = instance_information_dict['frontend-url-list'][0] for frontend in instance_information_dict['frontend-url-list']:
return "%s/erp5" % frontend_address 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): def getScalabilityTestMetricUrl(self, instance_information_dict, **kw):
frontend_address = instance_information_dict['frontend-url-list'][0] for frontend in instance_information_dict['frontend-url-list']:
metrics_url = frontend_address.replace("https://", if frontend[0] == ZOPE_USER_FAMILY:
"https://%s:%s@" % (instance_information_dict['user'], frontend_address = frontend[1]
break
port = 4443 if urlparse.urlparse(frontend_address).scheme == 'https' else 8080
frontend_address = "%s:%d" % (frontend_address, port)
metrics_url = frontend_address.replace("://",
"://%s:%s@" % (instance_information_dict['user'],
instance_information_dict['password'])) instance_information_dict['password']))
return metrics_url + "/erp5/ERP5Site_getScalabilityTestMetric" return metrics_url + "/erp5/ERP5Site_getScalabilityTestMetric"
...@@ -53,10 +65,13 @@ class ERP5_scalability(): ...@@ -53,10 +65,13 @@ class ERP5_scalability():
str(output_json[PERSON_KEY]), str(output_json[ORDER_KEY])) str(output_json[PERSON_KEY]), str(output_json[ORDER_KEY]))
def getBootstrapScalabilityTestUrl(self, instance_information_dict, count=0, **kw): def getBootstrapScalabilityTestUrl(self, instance_information_dict, count=0, **kw):
frontend_address = instance_information_dict['frontend-url-list'][0] for zope in instance_information_dict['zope-address-list']:
bootstrap_url = frontend_address.replace("https://", if zope[0] == ZOPE_USER_FAMILY:
"https://%s:%s@" % (instance_information_dict['user'], zope_address = zope[1]
instance_information_dict['password'])) break
bootstrap_url = "http://%s:%s@%s" % (instance_information_dict['user'],
instance_information_dict['password'],
zope_address)
bootstrap_url += "/erp5/ERP5Site_bootstrapScalabilityTest" bootstrap_url += "/erp5/ERP5Site_bootstrapScalabilityTest"
bootstrap_url += "?user_quantity=%i" % self.getUserQuantity(count) bootstrap_url += "?user_quantity=%i" % self.getUserQuantity(count)
return bootstrap_url return bootstrap_url
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