Commit 923d56ff authored by Jim Fulton's avatar Jim Fulton

Wait longer for a thread to do it's work to avoid a spurious test

failure.
parent a062f0af
...@@ -249,7 +249,7 @@ class GenericTests( ...@@ -249,7 +249,7 @@ class GenericTests(
key = '%s:%s' % (self._storage._storage, self._storage._server_addr) key = '%s:%s' % (self._storage._storage, self._storage._server_addr)
self.assertEqual(self._storage.sortKey(), key) self.assertEqual(self._storage.sortKey(), key)
def _do_store_in_separate_thread(self, oid, revid): def _do_store_in_separate_thread(self, oid, revid, voted):
def do_store(): def do_store():
store = ZEO.ClientStorage.ClientStorage(self._storage._addr) store = ZEO.ClientStorage.ClientStorage(self._storage._addr)
...@@ -270,7 +270,7 @@ class GenericTests( ...@@ -270,7 +270,7 @@ class GenericTests(
thread = threading.Thread(name='T2', target=do_store) thread = threading.Thread(name='T2', target=do_store)
thread.setDaemon(True) thread.setDaemon(True)
thread.start() thread.start()
thread.join(.2) thread.join(voted and .1 or 9)
return thread return thread
class FullGenericTests( class FullGenericTests(
......
...@@ -206,13 +206,13 @@ class BasicStorage: ...@@ -206,13 +206,13 @@ class BasicStorage:
self._storage.tpc_finish(t) self._storage.tpc_finish(t)
t.commit() t.commit()
def _do_store_in_separate_thread(self, oid, revid): def _do_store_in_separate_thread(self, oid, revid, voted):
# We'll run the competing trans in a separate thread: # We'll run the competing trans in a separate thread:
thread = threading.Thread(name='T2', thread = threading.Thread(name='T2',
target=self._dostore, args=(oid,), kwargs=dict(revid=revid)) target=self._dostore, args=(oid,), kwargs=dict(revid=revid))
thread.setDaemon(True) thread.setDaemon(True)
thread.start() thread.start()
thread.join(.2) thread.join(.1)
return thread return thread
def check_checkCurrentSerialInTransaction(self): def check_checkCurrentSerialInTransaction(self):
...@@ -262,7 +262,7 @@ class BasicStorage: ...@@ -262,7 +262,7 @@ class BasicStorage:
self._storage.tpc_vote(t) self._storage.tpc_vote(t)
# We'll run the competing trans in a separate thread: # We'll run the competing trans in a separate thread:
thread = self._do_store_in_separate_thread(oid, tid2) thread = self._do_store_in_separate_thread(oid, tid2, True)
self._storage.tpc_finish(t) self._storage.tpc_finish(t)
thread.join(1) thread.join(1)
...@@ -278,7 +278,7 @@ class BasicStorage: ...@@ -278,7 +278,7 @@ class BasicStorage:
'\0\0\0\0\0\0\0\0', 'x', '', t) '\0\0\0\0\0\0\0\0', 'x', '', t)
self._storage.checkCurrentSerialInTransaction(oid, tid3, t) self._storage.checkCurrentSerialInTransaction(oid, tid3, t)
thread = self._do_store_in_separate_thread(oid, tid3) thread = self._do_store_in_separate_thread(oid, tid3, False)
# There are 2 possibilities: # There are 2 possibilities:
# 1. The store happens before this transaction completes, # 1. The store happens before this transaction completes,
......
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