[CalendarServer-changes] [6873] CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/ test/test_adbapi2.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 3 15:41:52 PST 2011


Revision: 6873
          http://trac.macosforge.org/projects/calendarserver/changeset/6873
Author:   glyph at apple.com
Date:     2011-02-03 15:41:52 -0800 (Thu, 03 Feb 2011)
Log Message:
-----------
yet another edge case

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/test/test_adbapi2.py

Modified: CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/test/test_adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/test/test_adbapi2.py	2011-02-03 23:41:48 UTC (rev 6872)
+++ CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/test/test_adbapi2.py	2011-02-03 23:41:52 UTC (rev 6873)
@@ -613,4 +613,30 @@
         self.assertEquals(resultOf(self.pool.stopService()), [None])
 
 
+    def test_waitForAlreadyAbortedTransaction(self):
+        """
+        L{ConnectionPool.stopService} will wait for all transactions to shut
+        down before exiting, including those which have already been stopped.
+        """
+        it = self.pool.connection()
+        self.pauseHolders()
+        abortResult = resultOf(it.abort())
 
+        # steal it from the queue so we can do it out of order
+        d, work = self.holders[0].queue.pop()
+        # that should be the only work unit so don't continue if something else
+        # got in there
+        self.assertEquals(self.holders[0].queue, [])
+        self.assertEquals(len(self.holders), 1)
+        self.flushHolders()
+        stopResult = resultOf(self.pool.stopService())
+        # Sanity check that we haven't actually stopped it yet
+        self.assertEquals(abortResult, [])
+        # We haven't fired it yet, so the service had better not have stopped...
+        self.assertEquals(stopResult, [])
+        d.callback(None)
+        self.assertEquals(abortResult, [None])
+        self.assertEquals(stopResult, [None])
+
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110203/19b96d73/attachment.html>


More information about the calendarserver-changes mailing list