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

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 20 08:29:21 PST 2012


Revision: 8565
          http://trac.macosforge.org/projects/calendarserver/changeset/8565
Author:   cdaboo at apple.com
Date:     2012-01-20 08:29:21 -0800 (Fri, 20 Jan 2012)
Log Message:
-----------
412's are not errors, so don't record those as fails.

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

Modified: CalendarServer/trunk/contrib/performance/benchlib.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchlib.py	2012-01-20 01:53:18 UTC (rev 8564)
+++ CalendarServer/trunk/contrib/performance/benchlib.py	2012-01-20 16:29:21 UTC (rev 8565)
@@ -70,9 +70,9 @@
 
 @inlineCallbacks
 def _serial(fs):
-     for (f, args) in fs:
-         yield f(*args)
-     returnValue(None)
+    for (f, args) in fs:
+        yield f(*args)
+    returnValue(None)
 
 
 

Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py	2012-01-20 01:53:18 UTC (rev 8564)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py	2012-01-20 16:29:21 UTC (rev 8565)
@@ -33,7 +33,7 @@
 from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
 from twisted.internet.task import LoopingCall
 from twisted.web.http_headers import Headers
-from twisted.web.http import OK, MULTI_STATUS, CREATED, NO_CONTENT
+from twisted.web.http import OK, MULTI_STATUS, CREATED, NO_CONTENT, PRECONDITION_FAILED
 from twisted.web.client import Agent
 
 from caldavclientlibrary.protocol.webdav.propfindparser import PropFindParser
@@ -59,8 +59,8 @@
     """
     Raised when a response has a code other than the one expected.
 
-    @ivar expected: The response code which was expected.
-    @type expected: C{int}
+    @ivar expected: The response codes which was expected.
+    @type expected: C{tuple} of C{int}
 
     @ivar response: The response which was received
     @type response: L{twisted.web.client.Response}
@@ -237,7 +237,9 @@
             }
 
 
-    def _request(self, expectedResponseCode, method, url, headers=None, body=None):
+    def _request(self, expectedResponseCodes, method, url, headers=None, body=None):
+        if type(expectedResponseCodes) is int:
+            expectedResponseCodes = (expectedResponseCodes,)
         if headers is None:
             headers = Headers({})
         headers.setRawHeaders('User-Agent', [self.USER_AGENT])
@@ -250,7 +252,7 @@
             # not both.
             after = self.reactor.seconds()
 
-            success = response.code == expectedResponseCode
+            success = response.code in expectedResponseCodes
 
             # if not success:
             #     import pdb; pdb.set_trace()
@@ -261,7 +263,7 @@
 
             if success:
                 return response
-            raise IncorrectResponseCode(expectedResponseCode, response)
+            raise IncorrectResponseCode(expectedResponseCodes, response)
         d.addCallback(report)
         return d
 
@@ -733,7 +735,9 @@
 
             # At last, upload the new event definition
             d = self._request(
-                NO_CONTENT, 'PUT', self.root + href[1:].encode('utf-8'),
+                (NO_CONTENT, PRECONDITION_FAILED,),
+                'PUT',
+                self.root + href[1:].encode('utf-8'),
                 Headers({
                         'content-type': ['text/calendar'],
                         'if-match': [event.etag]}),
@@ -752,14 +756,18 @@
         # Change the event to have the new attendee instead of the old attendee
         vevent.mainComponent().removeProperty(oldAttendee)
         vevent.mainComponent().addProperty(newAttendee)
+        okCodes = NO_CONTENT
         headers = Headers({
                 'content-type': ['text/calendar'],
                 })
         if event.scheduleTag is not None:
             headers.addRawHeader('if-schedule-tag-match', event.scheduleTag)
+            okCodes = (NO_CONTENT, PRECONDITION_FAILED,)
 
         d = self._request(
-            NO_CONTENT, 'PUT', self.root + href[1:].encode('utf-8'),
+            okCodes,
+            'PUT',
+            self.root + href[1:].encode('utf-8'),
             headers, StringProducer(vevent.getTextWithTimezones(includeTimezones=True)))
         d.addCallback(self._updateEvent, href)
         return d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120120/1ab2bd0a/attachment.html>


More information about the calendarserver-changes mailing list