[Zope-Checkins]
SVN: Zope/branches/2.9/lib/python/Shared/DC/ZRDB/tests/test_caching.py
Yay! A test case which reproduces #2212..
Chris Withers
chris at simplistix.co.uk
Fri Nov 17 11:03:11 EST 2006
Log message for revision 71157:
Yay! A test case which reproduces #2212..
Changed:
U Zope/branches/2.9/lib/python/Shared/DC/ZRDB/tests/test_caching.py
-=-
Modified: Zope/branches/2.9/lib/python/Shared/DC/ZRDB/tests/test_caching.py
===================================================================
--- Zope/branches/2.9/lib/python/Shared/DC/ZRDB/tests/test_caching.py 2006-11-17 15:57:14 UTC (rev 71156)
+++ Zope/branches/2.9/lib/python/Shared/DC/ZRDB/tests/test_caching.py 2006-11-17 16:03:10 UTC (rev 71157)
@@ -290,6 +290,28 @@
{44: ('query3',1,'conn_id')}
)
+ def test_cachefull_but_not_old(self):
+ # get some old entries for one query in
+ # (the time are carefully picked to give out-of-order dict keys)
+ self._do_query('query1',5)
+ self._do_query('query1',15)
+ self._do_query('query1',43)
+ self._check_cache(
+ {('query1',1,'conn_id'): (43,'result for query1')},
+ {5: ('query1',1,'conn_id'),
+ 15: ('query1',1,'conn_id'),
+ 43: ('query1',1,'conn_id'),}
+ )
+ # now do another query
+ self._do_query('query2',41.1)
+ # XXX whoops, because {5:True,15:True,43:True}.keys()==[43,5,15]
+ # the cache/tcache clearing code makes a mistake:
+ # - the first time round the while loop, we remove 43 from the cache
+ # and tcache 'cos it matches the time in the cache
+ # - the 2nd time round, 5 is "too old", so we attempt to check
+ # if it matches the query in the cache, which blows up :-)
+ self.assertRaises(KeyError,self._do_query,'query3',41.2)
+
class DummyDA:
def __call__(self):
More information about the Zope-Checkins
mailing list