[CalendarServer-changes] [15384] CalendarServer/trunk/contrib/performance/loadtest
source_changes at macosforge.org
source_changes at macosforge.org
Mon Dec 14 08:57:48 PST 2015
Revision: 15384
http://trac.calendarserver.org//changeset/15384
Author: cdaboo at apple.com
Date: 2015-12-14 08:57:48 -0800 (Mon, 14 Dec 2015)
Log Message:
-----------
Sim should fail if pushes were expected but none were logged.
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/loadtest/config-old.plist
CalendarServer/trunk/contrib/performance/loadtest/config.plist
CalendarServer/trunk/contrib/performance/loadtest/profiles.py
CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py
Modified: CalendarServer/trunk/contrib/performance/loadtest/config-old.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config-old.plist 2015-12-14 15:58:10 UTC (rev 15383)
+++ CalendarServer/trunk/contrib/performance/loadtest/config-old.plist 2015-12-14 16:57:48 UTC (rev 15384)
@@ -216,6 +216,10 @@
<!-- The % of failures that constitute a failed test -->
<key>failCutoff</key>
<real>1.0</real>
+
+ <!-- There must be at least one push operation -->
+ <key>failIfNoPush</key>
+ <true/>
</dict>
</dict>
</array>
Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config.plist 2015-12-14 15:58:10 UTC (rev 15383)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist 2015-12-14 16:57:48 UTC (rev 15384)
@@ -215,6 +215,10 @@
<!-- The % of failures that constitute a failed test -->
<key>failCutoff</key>
<real>1.0</real>
+
+ <!-- There must be at least one push operation -->
+ <key>failIfNoPush</key>
+ <true/>
</dict>
</dict>
</array>
Modified: CalendarServer/trunk/contrib/performance/loadtest/profiles.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/profiles.py 2015-12-14 15:58:10 UTC (rev 15383)
+++ CalendarServer/trunk/contrib/performance/loadtest/profiles.py 2015-12-14 16:57:48 UTC (rev 15384)
@@ -525,6 +525,7 @@
return accepted
+
class AttachmentDownloader(ProfileBase):
"""
A Calendar user who downloads attachments.
@@ -535,6 +536,7 @@
):
self.enabled = enabled
+
def run(self):
self._subscription = self._client.catalog["eventChanged"].subscribe(self.eventChanged)
return Deferred()
@@ -1141,7 +1143,9 @@
if "failCutoff" in params:
self._fail_cut_off = params["failCutoff"]
+ self._fail_if_no_push = params.get("failIfNoPush", False)
+
def observe(self, event):
if event.get("type") == "operation":
event = event.copy()
@@ -1182,6 +1186,7 @@
_LATENCY_REASON = "Median %(operation)s scheduling lag greater than %(cutoff)sms"
_FAILED_REASON = "Greater than %(cutoff).0f%% %(operation)s failed"
+ _PUSH_MISSING_REASON = "Push was configured but no pushes were received by clients"
def failures(self):
reasons = []
@@ -1197,4 +1202,7 @@
reasons.append(self._FAILED_REASON % dict(
operation=operation.upper(), cutoff=self._fail_cut_off))
+ if self._fail_if_no_push and "push" not in self._perOperationTimes:
+ reasons.append(self._PUSH_MISSING_REASON)
+
return reasons
Modified: CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py 2015-12-14 15:58:10 UTC (rev 15383)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_profiles.py 2015-12-14 16:57:48 UTC (rev 15384)
@@ -1094,7 +1094,66 @@
logger.failures())
+ def test_failureNoPush(self):
+ """
+ If there are no pushes, L{OperationLogger.failures} will/will not fail depending
+ on whether the "failIfNoPush" parameter is set.
+ """
+ # No pushes, no param
+ logger = OperationLogger(outfile=StringIO())
+ for _ignore in range(98):
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='testing', success=True)
+ )
+ self.assertEqual(
+ [],
+ logger.failures())
+
+ # No pushes, have param True
+ logger = OperationLogger(outfile=StringIO(), failIfNoPush=True)
+ for _ignore in range(98):
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='testing', success=True)
+ )
+ self.assertEqual(
+ [OperationLogger._PUSH_MISSING_REASON],
+ logger.failures())
+
+ # Pushes, have param False
+ logger = OperationLogger(outfile=StringIO(), failIfNoPush=False)
+ for _ignore in range(98):
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='testing', success=True)
+ )
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='push', success=True)
+ )
+ self.assertEqual(
+ [],
+ logger.failures())
+
+ # Pushes, have param True
+ logger = OperationLogger(outfile=StringIO(), failIfNoPush=True)
+ for _ignore in range(98):
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='testing', success=True)
+ )
+ logger.observe(dict(
+ type='operation', phase='end', user='user01',
+ duration=0.25, label='push', success=True)
+ )
+ self.assertEqual(
+ [],
+ logger.failures())
+
+
+
class AlarmAcknowledgerTests(TestCase):
def test_pastTheHour(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151214/26fa1455/attachment-0001.html>
More information about the calendarserver-changes
mailing list