You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/02/08 20:21:43 UTC

couchdb commit: updated refs/heads/1994-merge-rcouch to 29b8a06

Updated Branches:
  refs/heads/1994-merge-rcouch c94569a67 -> 29b8a065e


couch_mrview: fix 10-index-changes.t

proper test to check the indexer.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/29b8a065
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/29b8a065
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/29b8a065

Branch: refs/heads/1994-merge-rcouch
Commit: 29b8a065e4085d061ab4ea1a3fa97b33fd8942b6
Parents: c94569a
Author: Benoit Chesneau <be...@apache.org>
Authored: Sat Feb 8 20:20:47 2014 +0100
Committer: Benoit Chesneau <be...@apache.org>
Committed: Sat Feb 8 20:20:47 2014 +0100

----------------------------------------------------------------------
 apps/couch_mrview/test/10-index-changes.t | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/29b8a065/apps/couch_mrview/test/10-index-changes.t
----------------------------------------------------------------------
diff --git a/apps/couch_mrview/test/10-index-changes.t b/apps/couch_mrview/test/10-index-changes.t
index f53e9ed..ce79eac 100644
--- a/apps/couch_mrview/test/10-index-changes.t
+++ b/apps/couch_mrview/test/10-index-changes.t
@@ -175,13 +175,13 @@ test_stream(Db) ->
 
 
 test_indexer(Db) ->
-    Result = run_query(Db, [{since, 14}]),
+    Result = run_query(Db, [{since, 14}, refresh]),
     Expect = {ok, 15, [{{15,14,<<"14">>},14}]},
     etap:is(Result, Expect, "refresh index by hand OK."),
 
     {ok, Db1} = save_doc(Db, 15),
-    timer:sleep(1000),
-    Result1 = run_query(Db, [{since, 14}]),
+    timer:sleep(1500),
+    Result1 = run_query(Db1, [{since, 14}], false),
     Expect1 = {ok, 16, [{{15,14,<<"14">>},14},
                        {{16,15,<<"15">>},15}]},
     etap:is(Result1, Expect1, "changes indexed in background OK."),
@@ -195,6 +195,9 @@ save_doc(Db, Id) ->
     couch_db:reopen(Db).
 
 run_query(Db, Opts) ->
+    run_query(Db, Opts, true).
+
+run_query(Db, Opts, Refresh) ->
     Fun = fun
         (stop, {LastSeq, Acc}) ->
             {ok, LastSeq, Acc};
@@ -203,7 +206,12 @@ run_query(Db, Opts) ->
         (Event, Acc) ->
             {ok, [Event | Acc]}
     end,
-    couch_mrview:refresh(Db, <<"_design/bar">>),
+    case Refresh of
+        true ->
+            couch_mrview:refresh(Db, <<"_design/bar">>);
+        false ->
+            ok
+    end,
     {ok, LastSeq, R} = couch_mrview_changes:handle_changes(Db, <<"_design/bar">>,
                                                   <<"baz">>, Fun, [], Opts),
     {ok, LastSeq, lists:reverse(R)}.