Commit 351dfdd5 authored by Jim Fulton's avatar Jim Fulton

Use wait_until to avoid spurious test failures on challenged machines.

parent 33800b70
...@@ -4,7 +4,7 @@ Invalidations while connecting ...@@ -4,7 +4,7 @@ Invalidations while connecting
As soon as a client registers with a server, it will recieve As soon as a client registers with a server, it will recieve
invalidations from the server. The client must be careful to queue invalidations from the server. The client must be careful to queue
these invalidations until it is ready to deal with them. At the time these invalidations until it is ready to deal with them. At the time
of the writing of this test, clients weren't careful enogh about of the writing of this test, clients weren't careful enough about
queing invalidations. This led to cache corruption in the form of queing invalidations. This led to cache corruption in the form of
both low-level file corruption as well as out-of-date records marked both low-level file corruption as well as out-of-date records marked
as current. as current.
...@@ -72,11 +72,13 @@ This tests tries to provoke this bug by: ...@@ -72,11 +72,13 @@ This tests tries to provoke this bug by:
... db = ZODB.DB(ZEO.ClientStorage.ClientStorage(addr, client='x')) ... db = ZODB.DB(ZEO.ClientStorage.ClientStorage(addr, client='x'))
... _ = lock.acquire() ... _ = lock.acquire()
... try: ... try:
... time.sleep(.1) ... wait_until("connected and we've caught up",
... assert (db.storage.lastTransaction() ... lambda :
... == db.storage._server.lastTransaction()), ( ... db.storage.is_connected()
... db.storage.lastTransaction(), ... and db.storage.lastTransaction()
... db.storage._server.lastTransactiion()) ... == db.storage._server.lastTransaction()
... )
...
... conn = db.open() ... conn = db.open()
... for i in range(1000): ... for i in range(1000):
... if conn.root()[i].value != conn2.root()[i].value: ... if conn.root()[i].value != conn2.root()[i].value:
......
...@@ -135,7 +135,7 @@ def test_suite(): ...@@ -135,7 +135,7 @@ def test_suite():
suite.addTest(sub) suite.addTest(sub)
suite.addTest(doctest.DocFileSuite( suite.addTest(doctest.DocFileSuite(
'invalidations_while_connecting.test', 'invalidations_while_connecting.test',
setUp=setupstack.setUpDirectory, tearDown=setupstack.tearDown, setUp=ZEO.tests.forker.setUp, tearDown=setupstack.tearDown,
)) ))
suite.layer = ZODB.tests.util.MininalTestLayer('ZEO Connection Tests') suite.layer = ZODB.tests.util.MininalTestLayer('ZEO Connection Tests')
return suite return suite
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment