summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Sun <tony.sun427@gmail.com>2017-10-27 10:43:58 -0700
committerTony Sun <tony.sun427@gmail.com>2017-10-27 10:43:58 -0700
commit4540b4ab80ee7da98e7044231ec0ef97c0b513b6 (patch)
treee93893d5a00b6efe13e4ae5f557287a8e0a316dd
parentf019e8ba4b992d0d5ba0b6b8c98091e97c1df61f (diff)
downloadcouchdb-4540b4ab80ee7da98e7044231ec0ef97c0b513b6.tar.gz
use delay instead
-rw-r--r--src/mango/test/mango.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mango/test/mango.py b/src/mango/test/mango.py
index 1ed2a2c04..dd58e7461 100644
--- a/src/mango/test/mango.py
+++ b/src/mango/test/mango.py
@@ -33,6 +33,11 @@ def get_from_environment(key, default):
value = os.environ.get(key)
return value if value is not None else default
+# add delay functionality
+def delay(n=5, t=0.2):
+ for i in range(0, n):
+ time.sleep(t)
+
class Database(object):
def __init__(self, dbname,
@@ -77,9 +82,9 @@ class Database(object):
def recreate(self):
self.delete()
- time.sleep(1)
+ delay()
self.create()
- time.sleep(1)
+ delay()
def save_doc(self, doc):
self.save_docs([doc])
@@ -166,13 +171,14 @@ class Database(object):
def delete_index(self, ddocid, name, idx_type="json"):
path = ["_index", ddocid, idx_type, name]
- r = self.sess.delete(self.path(path), params={"w": "1"})
+ r = self.sess.delete(self.path(path), params={"w": "3"})
+ delay()
r.raise_for_status()
def bulk_delete(self, docs):
body = {
"docids" : docs,
- "w": 1
+ "w": 3
}
body = json.dumps(body)
r = self.sess.post(self.path("_index/_bulk_delete"), data=body)