[CalendarServer-changes] [6925] CalendarServer/trunk/contrib/performance

source_changes at macosforge.org source_changes at macosforge.org
Mon Feb 14 12:22:07 PST 2011


Revision: 6925
          http://trac.macosforge.org/projects/calendarserver/changeset/6925
Author:   exarkun at twistedmatrix.com
Date:     2011-02-14 12:22:04 -0800 (Mon, 14 Feb 2011)
Log Message:
-----------
Fix incorrect URL when cleaning up after the find_events benchmark; add some value checking to the simple cal client to catch this problem in the future.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/benchlib.py
    CalendarServer/trunk/contrib/performance/find_events.py

Modified: CalendarServer/trunk/contrib/performance/benchlib.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchlib.py	2011-02-14 19:28:24 UTC (rev 6924)
+++ CalendarServer/trunk/contrib/performance/benchlib.py	2011-02-14 20:22:04 UTC (rev 6925)
@@ -39,19 +39,24 @@
         self.principal = principal
 
 
-    def deleteResource(self, url):
-        return self.agent.request('DELETE', 'http://%s%s' % (self.netloc, url))
+    def _makeURL(self, path):
+        if not path.startswith('/'):
+            raise ValueError("Pass a relative URL with an absolute path")
+        return 'http://%s%s' % (self.netloc, path)
 
 
-    def makeCalendar(self, url):
-        return self.agent.request(
-            'MKCALENDAR', 'http://%s%s' % (self.netloc, url))
+    def deleteResource(self, path):
+        return self.agent.request('DELETE', self._makeURL(path))
 
 
-    def writeData(self, url, data, contentType):
+    def makeCalendar(self, path):
+        return self.agent.request('MKCALENDAR', self._makeURL(path))
+
+
+    def writeData(self, path, data, contentType):
         return self.agent.request(
             'PUT',
-            'http://%s%s' % (self.netloc, url),
+            self._makeURL(path),
             Headers({'content-type': [contentType]}),
             StringProducer(data))
 
@@ -157,14 +162,15 @@
         except FirstError, e:
             e.subFailure.raiseException()
 
+        # Get rid of the completed Deferred
+        del l[index]
+
         if time() > start + sampleTime:
             # Wait for the rest of the outstanding requests to keep things tidy
             yield DeferredList(l)
             # And then move on
             break
         else:
-            # Get rid of the completed Deferred
-            del l[index]
             # And start a new operation to replace it
             l.append(once())
     

Modified: CalendarServer/trunk/contrib/performance/find_events.py
===================================================================
--- CalendarServer/trunk/contrib/performance/find_events.py	2011-02-14 19:28:24 UTC (rev 6924)
+++ CalendarServer/trunk/contrib/performance/find_events.py	2011-02-14 20:22:04 UTC (rev 6925)
@@ -93,6 +93,6 @@
 
     # Delete the calendar we created to leave the server in roughly
     # the same state as we found it.
-    yield account.deleteResource(cal)
+    yield account.deleteResource("/" + cal)
 
     returnValue(samples)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110214/f74dc5fa/attachment.html>


More information about the calendarserver-changes mailing list