Commit bdf6389d authored by Julien Muchembled's avatar Julien Muchembled

qa: tweak condition detecting endless tic

100 is too small for tests like testBasicStore (MySQL) and testDelayedStore.
parent 95fdc01d
...@@ -42,7 +42,7 @@ from .. import NeoTestBase, Patch, getTempDirectory, setupMySQLdb, \ ...@@ -42,7 +42,7 @@ from .. import NeoTestBase, Patch, getTempDirectory, setupMySQLdb, \
BIND = IP_VERSION_FORMAT_DICT[ADDRESS_TYPE], 0 BIND = IP_VERSION_FORMAT_DICT[ADDRESS_TYPE], 0
LOCAL_IP = socket.inet_pton(ADDRESS_TYPE, IP_VERSION_FORMAT_DICT[ADDRESS_TYPE]) LOCAL_IP = socket.inet_pton(ADDRESS_TYPE, IP_VERSION_FORMAT_DICT[ADDRESS_TYPE])
MAX_TIC_COUNT = 100 TIC_LOOP = xrange(1000)
class LockLock(object): class LockLock(object):
...@@ -255,7 +255,7 @@ class TestSerialized(Serialized): ...@@ -255,7 +255,7 @@ class TestSerialized(Serialized):
def poll(self, timeout): def poll(self, timeout):
if timeout: if timeout:
for x in xrange(MAX_TIC_COUNT): for x in TIC_LOOP:
r = self._epoll.poll(0) r = self._epoll.poll(0)
if r: if r:
return r return r
...@@ -578,7 +578,7 @@ class NEOCluster(object): ...@@ -578,7 +578,7 @@ class NEOCluster(object):
def _lock(blocking=True): def _lock(blocking=True):
if blocking: if blocking:
logging.info('<SimpleQueue>._lock.acquire()') logging.info('<SimpleQueue>._lock.acquire()')
for i in xrange(MAX_TIC_COUNT): for i in TIC_LOOP:
if lock(False): if lock(False):
return True return True
Serialized.tic(step=1, quiet=True) Serialized.tic(step=1, quiet=True)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
import unittest import unittest
from ZODB.tests.BasicStorage import BasicStorage from ZODB.tests.BasicStorage import BasicStorage
from ZODB.tests.StorageTestBase import StorageTestBase from ZODB.tests.StorageTestBase import StorageTestBase
...@@ -24,7 +25,11 @@ from .. import Patch, threaded ...@@ -24,7 +25,11 @@ from .. import Patch, threaded
class BasicTests(ZODBTestCase, StorageTestBase, BasicStorage): class BasicTests(ZODBTestCase, StorageTestBase, BasicStorage):
def check_checkCurrentSerialInTransaction(self): def check_checkCurrentSerialInTransaction(self):
with Patch(threaded, MAX_TIC_COUNT=100000): x = time.time() + 10
def tic_loop():
while time.time() < x:
yield
with Patch(threaded, TIC_LOOP=tic_loop()):
super(BasicTests, self).check_checkCurrentSerialInTransaction() super(BasicTests, self).check_checkCurrentSerialInTransaction()
if __name__ == "__main__": if __name__ == "__main__":
......
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