[CalendarServer-changes] [15334] CalendarServer/trunk/contrib/performance/loadtest
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 18 16:29:04 PST 2015
Revision: 15334
http://trac.calendarserver.org//changeset/15334
Author: sagen at apple.com
Date: 2015-11-18 16:29:04 -0800 (Wed, 18 Nov 2015)
Log Message:
-----------
Adds a Resetter profile, simulating a user deleting and re-adding their account, thus downloading all their events.
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/loadtest/clients.plist
CalendarServer/trunk/contrib/performance/loadtest/ical.py
CalendarServer/trunk/contrib/performance/loadtest/profiles.py
Modified: CalendarServer/trunk/contrib/performance/loadtest/clients.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/clients.plist 2015-11-18 22:08:01 UTC (rev 15333)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients.plist 2015-11-19 00:29:04 UTC (rev 15334)
@@ -679,6 +679,25 @@
</dict>
</dict>
+
+ <!-- A profile which will periodically reset itself, as if a user removed
+ and re-added their account. -->
+ <dict>
+ <key>class</key>
+ <string>contrib.performance.loadtest.profiles.Resetter</string>
+
+ <key>params</key>
+ <dict>
+ <key>enabled</key>
+ <true/>
+
+ <!-- Define the interval (in seconds) at which this profile will
+ reset its client. -->
+ <key>interval</key>
+ <integer>600</integer>
+ </dict>
+ </dict>
+
</array>
<!-- Determine the frequency at which this client configuration will
Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py 2015-11-18 22:08:01 UTC (rev 15333)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py 2015-11-19 00:29:04 UTC (rev 15334)
@@ -65,6 +65,7 @@
import json
import os
import random
+import shutil
QName.__repr__ = lambda self: '<QName %r>' % (self.text,)
@@ -1588,6 +1589,13 @@
self._calendars[calendar.url] = calendar
+ def reset(self):
+ path = self.serializeLocation()
+ if path is not None and os.path.exists(path):
+ shutil.rmtree(path)
+ return self.startup()
+
+
def _makeSelfAttendee(self):
attendee = Property(
name=u'ATTENDEE',
Modified: CalendarServer/trunk/contrib/performance/loadtest/profiles.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/profiles.py 2015-11-18 22:08:01 UTC (rev 15333)
+++ CalendarServer/trunk/contrib/performance/loadtest/profiles.py 2015-11-19 00:29:04 UTC (rev 15334)
@@ -993,7 +993,34 @@
return self._newOperation("create", d)
+class Resetter(ProfileBase):
+ """
+ A Calendar user who resets their account and re-downloads everything.
+ """
+ def setParameters(
+ self,
+ enabled=True,
+ interval=600,
+ ):
+ self.enabled = enabled
+ self._interval = interval
+
+
+ def run(self):
+ self._call = LoopingCall(self._resetAccount)
+ self._call.clock = self._reactor
+ return self._call.start(self._interval)
+
+
+ def _resetAccount(self):
+ # Don't perform any operations until the client is up and running
+ if not self._client.started:
+ return succeed(None)
+
+ return self._client.reset()
+
+
class OperationLogger(SummarizingMixin):
"""
Profiles will initiate operations which may span multiple requests. Start
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151118/53812946/attachment.html>
More information about the calendarserver-changes
mailing list