[CalendarServer-changes] [9401] CalendarServer/trunk/calendarserver/tools/test/test_purge_old_events .py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 29 11:57:49 PDT 2012
Revision: 9401
http://trac.macosforge.org/projects/calendarserver/changeset/9401
Author: cdaboo at apple.com
Date: 2012-06-29 11:57:48 -0700 (Fri, 29 Jun 2012)
Log Message:
-----------
Since we no longer cache actual end dates for old events, but rather use a 1901-01-01 value to indicate a partial cache,
it is not possible to deterministically know what the oldest event is, so batch=1 operations will remove a random old
event. Fix tests to account for that.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/test/test_purge_old_events.py
Modified: CalendarServer/trunk/calendarserver/tools/test/test_purge_old_events.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_purge_old_events.py 2012-06-29 18:21:08 UTC (rev 9400)
+++ CalendarServer/trunk/calendarserver/tools/test/test_purge_old_events.py 2012-06-29 18:57:48 UTC (rev 9401)
@@ -398,13 +398,11 @@
])
)
- # Query for oldest event
+ # Query for oldest event - actually with limited time caching, the oldest event
+ # cannot be precisely know, all we get back is the first one in the sorted list
+ # where each has the 1901 "dummy" time stamp to indicate a partial cache
results = (yield txn.eventsOlderThan(cutoff, batchSize=1))
- self.assertEquals(results,
- [
- ['home1', 'calendar1', 'old.ics', '1901-01-01 01:00:00'],
- ]
- )
+ self.assertEquals(len(results), 1)
@inlineCallbacks
@@ -412,17 +410,12 @@
cutoff = PyCalendarDateTime(now, 4, 1, 0, 0, 0)
txn = self._sqlCalendarStore.newTransaction()
- # Remove oldest event
+ # Remove oldest event - except we don't know what that is because of the dummy timestamps
+ # used with a partial index. So all we can check is that one event was removed.
count = (yield txn.removeOldEvents(cutoff, batchSize=1))
self.assertEquals(count, 1)
results = (yield txn.eventsOlderThan(cutoff))
- self.assertEquals(sorted(results),
- sorted([
- ['home1', 'calendar1', 'oldattachment.ics', '1901-01-01 01:00:00'],
- ['home2', 'calendar3', 'repeating_awhile.ics', '1901-01-01 01:00:00'],
- ['home2', 'calendar2', 'recent.ics', '%s-03-04 22:15:00' % (now,)],
- ])
- )
+ self.assertEquals(len(results), 3)
# Remove remaining oldest events
count = (yield txn.removeOldEvents(cutoff))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120629/b3c9d8ec/attachment-0001.html>
More information about the calendarserver-changes
mailing list