summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2008-07-29 16:16:23 (GMT)
committerJesus Cea <jcea@jcea.es>2008-07-29 16:16:23 (GMT)
commitcde8cdd898448c0aaf82cef5ddbc24f53dc8262d (patch)
tree567f0c0333c1ef106ac46913642df86706aa8b5d /Lib/bsddb
parenta99363f472a4393eaa00d039056fb5acbb75770c (diff)
downloadcpython-cde8cdd898448c0aaf82cef5ddbc24f53dc8262d.zip
cpython-cde8cdd898448c0aaf82cef5ddbc24f53dc8262d.tar.gz
cpython-cde8cdd898448c0aaf82cef5ddbc24f53dc8262d.tar.bz2
Be less strict with replication timeouts (the machine
can be a bit loaded), and be sure to yield the CPU when waiting.
Diffstat (limited to 'Lib/bsddb')
-rw-r--r--Lib/bsddb/test/test_replication.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/Lib/bsddb/test/test_replication.py b/Lib/bsddb/test/test_replication.py
index f9102d7..5d01b31 100644
--- a/Lib/bsddb/test/test_replication.py
+++ b/Lib/bsddb/test/test_replication.py
@@ -128,10 +128,10 @@ class DBReplicationManager(unittest.TestCase):
# is not generated if the master has no new transactions.
# This is solved in BDB 4.6 (#15542).
import time
- timeout = time.time()+2
+ timeout = time.time()+10
while (time.time()<timeout) and not (self.confirmed_master and self.client_startupdone) :
time.sleep(0.02)
- self.assertTrue(time.time()<timeout, msg = "Timeout Error: "+str(time.time()-timeout))
+ self.assertTrue(time.time()<timeout)
d = self.dbenvMaster.repmgr_site_list()
self.assertEquals(len(d), 1)
@@ -181,22 +181,28 @@ class DBReplicationManager(unittest.TestCase):
self.dbMaster.put("ABC", "123", txn=txn)
txn.commit()
import time
- timeout=time.time()+1
+ timeout=time.time()+10
v=None
while (time.time()<timeout) and (v==None) :
txn=self.dbenvClient.txn_begin()
v=self.dbClient.get("ABC", txn=txn)
txn.commit()
+ if v==None :
+ time.sleep(0.02)
+ self.assertTrue(time.time()<timeout)
self.assertEquals("123", v)
txn=self.dbenvMaster.txn_begin()
self.dbMaster.delete("ABC", txn=txn)
txn.commit()
- timeout=time.time()+1
+ timeout=time.time()+10
while (time.time()<timeout) and (v!=None) :
txn=self.dbenvClient.txn_begin()
v=self.dbClient.get("ABC", txn=txn)
txn.commit()
+ if v==None :
+ time.sleep(0.02)
+ self.assertTrue(time.time()<timeout)
self.assertEquals(None, v)
class DBBaseReplication(DBReplicationManager):
@@ -297,7 +303,7 @@ class DBBaseReplication(DBReplicationManager):
# is not generated if the master has no new transactions.
# This is solved in BDB 4.6 (#15542).
import time
- timeout = time.time()+2
+ timeout = time.time()+10
while (time.time()<timeout) and not (self.confirmed_master and
self.client_startupdone) :
time.sleep(0.02)
@@ -333,22 +339,28 @@ class DBBaseReplication(DBReplicationManager):
self.dbMaster.put("ABC", "123", txn=txn)
txn.commit()
import time
- timeout=time.time()+1
+ timeout=time.time()+10
v=None
while (time.time()<timeout) and (v==None) :
txn=self.dbenvClient.txn_begin()
v=self.dbClient.get("ABC", txn=txn)
txn.commit()
+ if v==None :
+ time.sleep(0.02)
+ self.assertTrue(time.time()<timeout)
self.assertEquals("123", v)
txn=self.dbenvMaster.txn_begin()
self.dbMaster.delete("ABC", txn=txn)
txn.commit()
- timeout=time.time()+1
+ timeout=time.time()+10
while (time.time()<timeout) and (v!=None) :
txn=self.dbenvClient.txn_begin()
v=self.dbClient.get("ABC", txn=txn)
txn.commit()
+ if v==None :
+ time.sleep(0.02)
+ self.assertTrue(time.time()<timeout)
self.assertEquals(None, v)
if db.version() >= (4,7) :