Permalink
Browse files

CBQE-1468: add reproducer for MB-7764

Change-Id: If382fd2400cc176410e12aaf0b26b6fa6e28fd46
Reviewed-on: http://review.couchbase.org/39074
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Iryna Mironava <irynamironava@yandex.ru>
  • Loading branch information...
1 parent f5b5bab commit 9e0d0fd6cb526ad5e52fc3a33049802c887348ed @IrynaMironava IrynaMironava committed with IrynaMironava Jul 2, 2014
Showing with 19 additions and 1 deletion.
  1. +1 −0 conf/view-conf/py-viewquery.conf
  2. +18 −1 pytests/view/viewquerytests.py
@@ -45,6 +45,7 @@ view.viewquerytests.ViewQueryTests:
test_concurrent_threads,num-docs=100000,GROUP=P1
test_simple_dataset_startkey_endkey_queries_with_pass_change,GROUP=P1
test_index_in_with_cluster_ramquota_change,GROUP=P1
+ test_add_MB_7764_reproducer,GROUP=P1
#view queries tests from rebalance suites
rebalance.rebalancein.RebalanceInTests:
incremental_rebalance_in_with_queries,blob_generator=False,items=10000,GROUP=P0
@@ -1837,6 +1837,13 @@ def test_MB_7978_reproducer(self):
self._query_all_views(data_set.views, generator_load,
verify_expected_keys=True)
+ def test_add_MB_7764_reproducer(self):
+ data_set = SalesDataSet(self.master, self.cluster, self.docs_per_day, custom_reduce=True)
+ data_set.add_reduce_queries({'reduce' :'true'})
+ generator_load = data_set.generate_docs(data_set.views[0])
+ self.load(data_set, generator_load)
+ self._query_all_views(data_set.views, generator_load)
+
def test_concurrent_threads(self):
num_ddocs = self.input.param("num_ddocs", 8)
#threads per view
@@ -2684,7 +2691,8 @@ def add_all_query_sets(self, views=None, limit=None):
self.add_stale_queries(views, limit)
class SalesDataSet:
- def __init__(self, server, cluster, docs_per_day=200, bucket="default", test_datatype=False, template_items_num=None):
+ def __init__(self, server, cluster, docs_per_day=200, bucket="default", test_datatype=False, template_items_num=None,
+ custom_reduce=True):
self.server = server
self.cluster = cluster
self.docs_per_day = docs_per_day
@@ -2694,6 +2702,7 @@ def __init__(self, server, cluster, docs_per_day=200, bucket="default", test_dat
self.bucket = bucket
self.test_datatype = test_datatype
self.template_items_num = template_items_num
+ self.custom_reduce = custom_reduce
self.views = self.create_views()
self.name = "sales_dataset"
self.kv_store = None
@@ -2720,6 +2729,14 @@ def create_views(self):
vfn1 = "function (doc) { emit([doc.join_yr, doc.join_mo, doc.join_day], doc.sales);}"
views = [QueryView(self.server, self.cluster, bucket=self.bucket, fn_str=vfn1),
QueryView(self.server, self.cluster, bucket=self.bucket, fn_str=vfn1, reduce_fn="_count")]
+ elif self.custom_reduce:
+ reduce_fn = "function(key, values, rereduce) { if (rereduce)" +\
+ " { var result = 0; for (var i = 0; i < values.length; i++) " +\
+ "{ emit(key,values[0]); result += values[i]; } return result;" +\
+ " } else { emit(key,values[0]); return values.length; }}"
+ views = [QueryView(self.server, self.cluster, bucket=self.bucket, fn_str=vfn, reduce_fn=reduce_fn)]
+ for view in views:
+ view.view.red_func = '_count'
else:
views = [QueryView(self.server, self.cluster, bucket=self.bucket, fn_str=vfn, reduce_fn="_count"),
QueryView(self.server, self.cluster, bucket=self.bucket, fn_str=vfn, reduce_fn="_sum"),

0 comments on commit 9e0d0fd

Please sign in to comment.