[CalendarServer-changes] [11302] CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/ enterprise/test/test_queue.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 5 11:42:10 PDT 2013
Revision: 11302
http://trac.calendarserver.org//changeset/11302
Author: glyph at apple.com
Date: 2013-06-05 11:42:10 -0700 (Wed, 05 Jun 2013)
Log Message:
-----------
Failing test.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py
Modified: CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py
===================================================================
--- CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py 2013-06-05 18:42:10 UTC (rev 11301)
+++ CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py 2013-06-05 18:42:10 UTC (rev 11302)
@@ -716,6 +716,39 @@
self.assertEquals(rows, [[4321, 7]])
+ @inlineCallbacks
+ def test_noWorkDoneWhenConcurrentlyDeleted(self):
+ """
+ When a L{WorkItem} is concurrently deleted by another transaction, it
+ should I{not} perform its work.
+ """
+ # Provide access to a method called 'concurrently' everything using
+ original = self.store.newTransaction
+ def decorate(*a, **k):
+ result = original()
+ result.concurrently = original
+ return result
+ self.store.newTransaction = decorate
+
+ def operation(txn):
+ return txn.enqueue(DummyWorkItem, a=30, b=40, workID=5678,
+ notBefore=datetime.datetime.utcnow())
+ proposal = yield inTransaction(self.store.newTransaction, operation)
+ yield proposal.whenExecuted()
+ # Sanity check on the concurrent deletion.
+ def op2(txn):
+ return Select([schema.DUMMY_WORK_ITEM.WORK_ID],
+ From=schema.DUMMY_WORK_ITEM).on(txn)
+ rows = yield inTransaction(self.store.newTransaction, op2)
+ def op3(txn):
+ return Select([schema.DUMMY_WORK_DONE.WORK_ID,
+ schema.DUMMY_WORK_DONE.A_PLUS_B],
+ From=schema.DUMMY_WORK_DONE).on(txn)
+ rows = yield inTransaction(self.store.newTransaction, op3)
+ self.assertEquals(rows, [])
+
+
+
class DummyProposal(object):
def __init__(self, *ignored):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130605/e28450ee/attachment-0001.html>
More information about the calendarserver-changes
mailing list