[CalendarServer-changes] [7643] CalendarServer/trunk/contrib/performance/loadtest

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 21 13:44:44 PDT 2011


Revision: 7643
          http://trac.macosforge.org/projects/calendarserver/changeset/7643
Author:   exarkun at twistedmatrix.com
Date:     2011-06-21 13:44:44 -0700 (Tue, 21 Jun 2011)
Log Message:
-----------
Support HTTPS

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/config.plist
    CalendarServer/trunk/contrib/performance/loadtest/ical.py
    CalendarServer/trunk/contrib/performance/loadtest/population.py
    CalendarServer/trunk/contrib/performance/loadtest/sim.py
    CalendarServer/trunk/contrib/performance/loadtest/test_ical.py
    CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py
    CalendarServer/trunk/contrib/performance/loadtest/test_sim.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config.plist	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist	2011-06-21 20:44:44 UTC (rev 7643)
@@ -21,16 +21,8 @@
   <dict>
     <!-- Identify the server to be load tested. -->
     <key>server</key>
-    <dict>
-      <!-- Hostname or IPv4 address the server is listening on -->
-      <key>host</key>
-      <string>127.0.0.1</string>
+    <string>https://127.0.0.1:8443/</string>
 
-      <!-- Port number the server is listening on -->
-      <key>port</key>
-      <integer>8008</integer>
-    </dict>
-
     <!-- Define the credentials of the clients which will be used to load test
          the server.  These credentials must already be valid on the
          server. -->

Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -159,10 +159,10 @@
 
     email = None
 
-    def __init__(self, reactor, host, port, user, auth, calendarHomePollInterval=None):
+    def __init__(self, reactor, root, user, auth, calendarHomePollInterval=None):
         self.reactor = reactor
         self.agent = AuthHandlerAgent(Agent(self.reactor), auth)
-        self.root = 'http://%s:%d/' % (host, port)
+        self.root = root
         self.user = user
 
         if calendarHomePollInterval is None:

Modified: CalendarServer/trunk/contrib/performance/loadtest/population.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/population.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/population.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -136,12 +136,11 @@
 
 
 class CalendarClientSimulator(object):
-    def __init__(self, records, populator, parameters, reactor, host, port):
+    def __init__(self, records, populator, parameters, reactor, server):
         self._records = records
         self.populator = populator
         self.reactor = reactor
-        self.host = host
-        self.port = port
+        self.server = server
         self._pop = self.populator.populate(parameters)
         self._user = 0
 
@@ -163,7 +162,7 @@
         auth = HTTPDigestAuthHandler()
         auth.add_password(
             realm="Test Realm",
-            uri="http://%s:%d/" % (self.host, self.port),
+            uri=self.server,
             user=user.encode('utf-8'),
             passwd=record.password.encode('utf-8'))
         return user, auth
@@ -177,7 +176,7 @@
             clientType = self._pop.next()
             reactor = loggedReactor(self.reactor)
             client = clientType.clientType(
-                reactor, self.host, self.port, user, auth)
+                reactor, self.server, user, auth)
             d = client.run()
             d.addErrback(self._clientFailure, reactor)
 

Modified: CalendarServer/trunk/contrib/performance/loadtest/sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/sim.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/sim.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -134,7 +134,6 @@
             raise UsageError("Specify a configuration file using --config <path>")
 
 
-Server = namedtuple('Server', 'host port')
 Arrival = namedtuple('Arrival', 'factory parameters')
 
 
@@ -143,7 +142,7 @@
     A L{LoadSimulator} simulates some configuration of calendar
     clients.
 
-    @type server: L{Server}
+    @type server: C{str}
     @type arrival: L{Arrival}
     @type parameters: L{PopulationParameters}
 
@@ -173,12 +172,9 @@
         except UsageError, e:
             raise SystemExit(str(e))
 
+        server = 'http://127.0.0.1:8008/'
         if 'server' in options.config:
-            server = Server( 
-                options.config['server']['host'],
-                options.config['server']['port'])
-        else:
-            server = Server('127.0.0.1', 8008)
+            server = options.config['server']
 
         if 'arrival' in options.config:
             arrival = Arrival(
@@ -249,12 +245,9 @@
 
 
     def createSimulator(self):
-        host = self.server.host
-        port = self.server.port
         populator = Populator(Random())
         return CalendarClientSimulator(
-            self.records, populator, self.parameters, self.reactor,
-            host, port)
+            self.records, populator, self.parameters, self.reactor, self.server)
 
 
     def createArrivalPolicy(self):

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -817,7 +817,7 @@
     """
     def setUp(self):
         self.user = "user91"
-        self.client = SnowLeopard(None, "127.0.0.1", 80, self.user, None)
+        self.client = SnowLeopard(None, "http://127.0.0.1/", self.user, None)
 
 
     def interceptRequests(self):
@@ -929,7 +929,7 @@
         # iCal PUTs the new VCALENDAR object.
         expectedResponseCode, method, url, headers, body = req
         self.assertEquals(method, 'PUT')
-        self.assertEquals(url, 'http://127.0.0.1:80' + event.url)
+        self.assertEquals(url, 'http://127.0.0.1' + event.url)
         self.assertIsInstance(url, str)
         self.assertEquals(headers.getRawHeaders('content-type'), ['text/calendar'])
 
@@ -960,7 +960,7 @@
         # iCal PUTs the new VCALENDAR object.
         expectedResponseCode, method, url, headers, body = req
         self.assertEquals(method, 'PUT')
-        self.assertEquals(url, 'http://127.0.0.1:80/mumble/frotz.ics')
+        self.assertEquals(url, 'http://127.0.0.1/mumble/frotz.ics')
         self.assertIsInstance(url, str)
         self.assertEquals(headers.getRawHeaders('content-type'), ['text/calendar'])
 
@@ -993,7 +993,7 @@
 
         expectedResponseCode, method, url = req
         self.assertEquals(method, 'DELETE')
-        self.assertEquals(url, 'http://127.0.0.1:80' + event.url)
+        self.assertEquals(url, 'http://127.0.0.1' + event.url)
         self.assertIsInstance(url, str)
 
         self.assertNotIn(event.url, self.client._events)
@@ -1095,7 +1095,7 @@
         result, req = requests.pop(0)
         expectedResponseCode, method, url, headers, body = req
         self.assertEqual('PROPFIND', method)
-        self.assertEqual('http://127.0.0.1:80/something/', url)
+        self.assertEqual('http://127.0.0.1/something/', url)
         self.assertEqual(MULTI_STATUS, expectedResponseCode)
 
         result.callback(
@@ -1106,7 +1106,7 @@
         result, req = requests.pop(0)
         expectedResponseCode, method, url, headers, body = req
         self.assertEqual('REPORT', method)
-        self.assertEqual('http://127.0.0.1:80/something/', url)
+        self.assertEqual('http://127.0.0.1/something/', url)
         self.assertEqual(MULTI_STATUS, expectedResponseCode)
 
         # Someone else comes along and gets rid of the event
@@ -1149,7 +1149,7 @@
         self.assertEqual(OK, expectedResponseCode)
         self.assertEqual('POST', method)
         self.assertEqual(
-            'http://127.0.0.1:80/calendars/__uids__/%s/outbox/' % (self.user,),
+            'http://127.0.0.1/calendars/__uids__/%s/outbox/' % (self.user,),
             url)
 
         self.assertEqual(headers.getRawHeaders('originator'), ['mailto:user01 at example.com'])

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -256,7 +256,7 @@
     """
     def setUp(self):
         self.sim = CalendarClientSimulator(
-            AnyUser(), Populator(None), None, None, None, None)
+            AnyUser(), Populator(None), None, None, None)
 
 
     def _simpleAccount(self, userNumber, eventText):
@@ -437,7 +437,7 @@
     """
     def setUp(self):
         self.sim = CalendarClientSimulator(
-            AnyUser(), Populator(None), None, None, None, None)
+            AnyUser(), Populator(None), None, None, None)
 
 
     def test_ignoreEventOnUnknownCalendar(self):
@@ -639,7 +639,7 @@
     """
     def setUp(self):
         self.sim = CalendarClientSimulator(
-            AnyUser(), Populator(None), None, None, None, None)
+            AnyUser(), Populator(None), None, None, None)
 
 
     def test_doNotAddEventOnInbox(self):

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_sim.py	2011-06-20 23:42:11 UTC (rev 7642)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_sim.py	2011-06-21 20:44:44 UTC (rev 7643)
@@ -37,13 +37,10 @@
     SmoothRampUp, ClientType, PopulationParameters, Populator, CalendarClientSimulator,
     ProfileType, SimpleStatistics)
 from loadtest.sim import (
-    Server, Arrival, SimOptions, LoadSimulator, LagTrackingReactor, main)
+    Arrival, SimOptions, LoadSimulator, LagTrackingReactor, main)
 
 VALID_CONFIG = {
-    'server': {
-        'host': '127.0.0.1',
-        'port': 8008,
-        },
+    'server': 'tcp:127.0.0.1:8008',
     'arrival': {
         'factory': 'loadtest.population.SmoothRampUp',
         'params': {
@@ -123,7 +120,7 @@
         """
         calsim = CalendarClientSimulator(
             [self._user('alice'), self._user('bob'), self._user('carol')],
-            Populator(None), None, None, 'example.org', 1234)
+            Populator(None), None, None, 'http://example.org:1234/')
         users = sorted([
                 calsim._createUser(0)[0],
                 calsim._createUser(1)[0],
@@ -139,7 +136,7 @@
         """
         calsim = CalendarClientSimulator(
             [self._user('alice')],
-            Populator(None), None, None, 'example.org', 1234)
+            Populator(None), None, None, 'http://example.org:1234/')
         user, auth = calsim._createUser(0)
         self.assertEqual(
             auth.passwd.find_user_password('Test Realm', 'http://example.org:1234/')[1],
@@ -205,16 +202,14 @@
         with its own reactor and host and port information from the
         configuration file.
         """
-        host = '127.0.0.7'
-        port = 1243
+        server = 'http://127.0.0.7:1243/'
         reactor = object()
-        sim = LoadSimulator(Server(host, port), None, None, reactor=reactor)
+        sim = LoadSimulator(server, None, None, reactor=reactor)
         calsim = sim.createSimulator()
         self.assertIsInstance(calsim, CalendarClientSimulator)
         self.assertIsInstance(calsim.reactor, LagTrackingReactor)
         self.assertIdentical(calsim.reactor._reactor, reactor)
-        self.assertEquals(calsim.host, host)
-        self.assertEquals(calsim.port, port)
+        self.assertEquals(calsim.server, server)
 
 
     def test_loadAccountsFromFile(self):
@@ -250,13 +245,9 @@
         """
         config = FilePath(self.mktemp())
         config.setContent(writePlistToString({
-                    "server": {
-                        "host": "127.0.0.1",
-                        "port": 1234,
-                        },
-                    }))
+                    "server": "https://127.0.0.3:8432/"}))
         sim = LoadSimulator.fromCommandLine(['--config', config.path])
-        self.assertEquals(sim.server, Server("127.0.0.1", 1234))
+        self.assertEquals(sim.server, "https://127.0.0.3:8432/")
 
 
     def test_loadArrivalConfig(self):
@@ -360,6 +351,7 @@
         self.assertEquals(len(sim.observers), 1)
         self.assertIsInstance(sim.observers[0], SimpleStatistics)
 
+
     def test_observeRunReport(self):
         """
         Each log observer is added to the log publisher before the
@@ -368,7 +360,7 @@
         """
         observers = [Observer()]
         sim = LoadSimulator(
-            Server('example.com', 123), 
+            "http://example.com:123/",
             Arrival(lambda reactor: NullArrival(), {}),
             None, observers, reactor=Reactor())
         sim.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110621/8e8ea4d6/attachment-0001.html>


More information about the calendarserver-changes mailing list