summaryrefslogtreecommitdiff
path: root/src/mango/test/user_docs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mango/test/user_docs.py')
-rw-r--r--src/mango/test/user_docs.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mango/test/user_docs.py b/src/mango/test/user_docs.py
index a1b6c6e1a..b2a19eea7 100644
--- a/src/mango/test/user_docs.py
+++ b/src/mango/test/user_docs.py
@@ -58,9 +58,18 @@ def setup_users(db, **kwargs):
db.save_docs(copy.deepcopy(USERS_DOCS))
-def setup(db, index_type="view", **kwargs):
+def setup(db, index_type="view", partitioned=False, **kwargs):
db.recreate()
- db.save_docs(copy.deepcopy(DOCS))
+ p = str(partitioned).lower()
+ docs = copy.deepcopy(DOCS)
+
+ if partitioned:
+ for index, doc in enumerate(docs):
+ partition = index % PARTITIONS
+ doc["_id"] = "{}:{}".format(partition, doc["_id"])
+
+ db.save_docs(docs, partitioned=p)
+
if index_type == "view":
add_view_indexes(db, kwargs)
elif index_type == "text":
@@ -96,6 +105,8 @@ def add_text_indexes(db, kwargs):
db.create_text_index(**kwargs)
+PARTITIONS = 3
+
DOCS = [
{
"_id": "71562648-6acb-42bc-a182-df6b1f005b09",