[Checkins] SVN: zc.zk/trunk/src/zc/zk/ Fixed testing: There were spurious errors when closing a testing
Jim Fulton
jim at zope.com
Fri Jan 27 16:59:09 UTC 2012
Log message for revision 124217:
Fixed testing: There were spurious errors when closing a testing
ZooKeeper connection in which ephemeral nodes were created and when
they were deleted by another session.
Changed:
U zc.zk/trunk/src/zc/zk/README.txt
U zc.zk/trunk/src/zc/zk/testing.py
U zc.zk/trunk/src/zc/zk/tests.py
-=-
Modified: zc.zk/trunk/src/zc/zk/README.txt
===================================================================
--- zc.zk/trunk/src/zc/zk/README.txt 2012-01-27 16:02:15 UTC (rev 124216)
+++ zc.zk/trunk/src/zc/zk/README.txt 2012-01-27 16:59:08 UTC (rev 124217)
@@ -1104,6 +1104,13 @@
Change History
==============
+0.6.1 (2012-01-27)
+------------------
+
+- Fixed testing: There were spurious errors when closing a testing
+ ZooKeeper connection in which ephemeral nodes were created and when
+ they were deleted by another session.
+
0.6.0 (2012-01-25)
------------------
Modified: zc.zk/trunk/src/zc/zk/testing.py
===================================================================
--- zc.zk/trunk/src/zc/zk/testing.py 2012-01-27 16:02:15 UTC (rev 124216)
+++ zc.zk/trunk/src/zc/zk/testing.py 2012-01-27 16:59:08 UTC (rev 124217)
@@ -311,10 +311,25 @@
return node
def _clear_session(self, session, event=None, state=None):
+ """
+ Test: don't sweat ephemeral nodes that were already deleted
+
+ >>> zk = zc.zk.ZK('zookeeper.example.com:2181')
+ >>> zk.register_server('/fooservice/providers', 'a:b')
+
+ >>> zk2 = zc.zk.ZK('zookeeper.example.com:2181')
+ >>> zk2.delete_recursive('/fooservice', force=True)
+ >>> zk2.close()
+
+ >>> zk.close()
+ """
with self.lock:
self.root.clear_watchers(session.handle, event, state)
for path in list(session.nodes):
- self._delete(session.handle, path)
+ try:
+ self._delete(session.handle, path)
+ except zookeeper.NoNodeException:
+ pass # deleted in another session, perhaps
def _doasync(self, completion, handle, nreturn, func, *args):
if completion is None:
Modified: zc.zk/trunk/src/zc/zk/tests.py
===================================================================
--- zc.zk/trunk/src/zc/zk/tests.py 2012-01-27 16:02:15 UTC (rev 124216)
+++ zc.zk/trunk/src/zc/zk/tests.py 2012-01-27 16:59:08 UTC (rev 124217)
@@ -1499,6 +1499,11 @@
setUp=zc.zk.testing.setUp, tearDown=zc.zk.testing.tearDown,
checker=checker,
),
+ doctest.DocTestSuite(
+ 'zc.zk.testing',
+ setUp=zc.zk.testing.setUp, tearDown=zc.zk.testing.tearDown,
+ checker=checker,
+ ),
))
if not zc.zk.testing.testing_with_real_zookeeper():
suite.addTest(unittest.makeSuite(Tests))
More information about the checkins
mailing list