[CalendarServer-changes] [11008] CalendarServer/branches/users/glyph/q-no-master/calendarserver/tap/ test/test_caldav.py

source_changes at macosforge.org source_changes at macosforge.org
Sun Apr 7 22:21:38 PDT 2013


Revision: 11008
          http://trac.calendarserver.org//changeset/11008
Author:   glyph at apple.com
Date:     2013-04-07 22:21:38 -0700 (Sun, 07 Apr 2013)
Log Message:
-----------
Failing test for wrong queuer.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q-no-master/calendarserver/tap/test/test_caldav.py

Modified: CalendarServer/branches/users/glyph/q-no-master/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/q-no-master/calendarserver/tap/test/test_caldav.py	2013-04-08 05:14:53 UTC (rev 11007)
+++ CalendarServer/branches/users/glyph/q-no-master/calendarserver/tap/test/test_caldav.py	2013-04-08 05:21:38 UTC (rev 11008)
@@ -33,11 +33,12 @@
 
 from twisted.internet.interfaces import IProcessTransport, IReactorProcess
 from twisted.internet.protocol import ServerFactory
-from twisted.internet.defer import Deferred, inlineCallbacks
+from twisted.internet.defer import Deferred, inlineCallbacks, passthru
 from twisted.internet.task import Clock
 from twisted.internet import reactor
 
-from twisted.application.service import IService, IServiceCollection
+from twisted.application.service import (IService, IServiceCollection,
+                                         MultiService)
 from twisted.application import internet
 
 from twext.web2.dav import auth
@@ -62,6 +63,7 @@
     _CONTROL_SERVICE_NAME, getSystemIDs
 )
 from calendarserver.provision.root import RootResource
+from twext.enterprise.queue import PeerConnectionPool, LocalQueuer
 from StringIO import StringIO
 
 
@@ -358,14 +360,16 @@
         writePlist(self.config, self.configFile)
 
 
-    def makeService(self):
+    def makeService(self, patcher=passthru):
         """
         Create a service by calling into CalDAVServiceMaker with
         self.configFile
         """
         self.options.parseOptions(["-f", self.configFile])
 
-        return CalDAVServiceMaker().makeService(self.options)
+        maker = CalDAVServiceMaker()
+        maker = patcher(maker)
+        return maker.makeService(self.options)
 
 
     def getSite(self):
@@ -507,8 +511,38 @@
         )
 
 
+    def test_storeQueuerSetInMaster(self):
+        """
+        In the master, the store's queuer should be set to a
+        L{PeerConnectionPool}, so that work can be distributed to other
+        processes.
+        """
+        self.config["ProcessType"] = "Combined"
+        self.writeConfig()
+        class NotAStore(object):
+            queuer = LocalQueuer(None)
+            def newTransaction(self):
+                return None
+            def callWithNewTransactions(self, x):
+                pass
+        store = NotAStore()
+        def patch(maker):
+            def storageServiceStandIn(createMainService, logObserver,
+                                      uid=None, gid=None):
+                pool = None
+                logObserver = None
+                svc = createMainService(pool, store, logObserver)
+                multi = MultiService()
+                svc.setServiceParent(multi)
+                return multi
+            self.patch(maker, "storageService", storageServiceStandIn)
+            return maker
+        self.makeService(patch)
+        self.assertIsInstance(store.queuer, PeerConnectionPool)
 
 
+
+
 class SlaveServiceTest(BaseServiceMakerTests):
     """
     Test various configurations of the Slave service
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130407/beafaa86/attachment-0001.html>


More information about the calendarserver-changes mailing list