kolabd/process.py tests/functional

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Dec 26 15:38:17 CET 2012


 kolabd/process.py                                  |   19 ++++++++++---------
 tests/functional/test_kolabd/test_001_user_sync.py |    8 ++++++++
 2 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 7a2de6e118b1b88a34efa87cbd27f398a690c717
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Dec 26 15:37:53 2012 +0100

    Loop through the thread's synchronization routine continuously

diff --git a/kolabd/process.py b/kolabd/process.py
index c936fdc..f5f5352 100644
--- a/kolabd/process.py
+++ b/kolabd/process.py
@@ -17,6 +17,7 @@
 #
 
 import multiprocessing
+import os
 import time
 
 import pykolab
@@ -37,12 +38,12 @@ class KolabdProcess(multiprocessing.Process):
             )
 
     def synchronize(self, domain):
-        try:
-            auth = Auth(domain)
-            auth.connect(domain)
-            auth.synchronize()
-        except Exception, errmsg:
-            log.error(_("Error in process %r, terminating:\n\t%r") % (self.name, errmsg))
-            import traceback
-            traceback.print_exc()
-            return
+        while True:
+            try:
+                auth = Auth(domain)
+                auth.connect(domain)
+                auth.synchronize()
+            except Exception, errmsg:
+                log.error(_("Error in process %r, terminating:\n\t%r") % (self.name, errmsg))
+                import traceback
+                traceback.print_exc()
diff --git a/tests/functional/test_kolabd/test_001_user_sync.py b/tests/functional/test_kolabd/test_001_user_sync.py
index 44858bb..aef47aa 100644
--- a/tests/functional/test_kolabd/test_001_user_sync.py
+++ b/tests/functional/test_kolabd/test_001_user_sync.py
@@ -48,6 +48,8 @@ class TestKolabDaemon(unittest.TestCase):
             }
         user_add("Jane", "Doe")
 
+        time.sleep(3)
+
         auth = Auth()
         auth.connect()
         recipient = auth.find_recipient("%(local)s@%(domain)s" % (user))
@@ -58,6 +60,12 @@ class TestKolabDaemon(unittest.TestCase):
 
         result = wap_client.user_info(recipient)
 
+        if not result.has_key('mailhost'):
+            from tests.functional.synchronize import synchronize_once
+            synchronize_once()
+
+        result = wap_client.user_info(recipient)
+
         self.assertEqual(result['mail'], 'jane.doe at example.org')
         self.assertEqual(result['alias'], ['doe2 at example.org', 'j.doe2 at example.org'])
 





More information about the commits mailing list