couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb] branch master updated: Avoid race condition in couch_mrview_ddoc_updated_tests (#764)
Date Wed, 23 Aug 2017 15:07:47 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new e2037dc  Avoid race condition in couch_mrview_ddoc_updated_tests (#764)
e2037dc is described below

commit e2037dc71ab88c7b036ef5709946b8ff781638b1
Author: Mayya Sharipova <mayya.sharipova@gmail.com>
AuthorDate: Wed Aug 23 11:07:45 2017 -0400

    Avoid race condition in couch_mrview_ddoc_updated_tests (#764)
    
    Fixes issue #757
---
 src/couch_mrview/test/couch_mrview_ddoc_updated_tests.erl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/couch_mrview/test/couch_mrview_ddoc_updated_tests.erl b/src/couch_mrview/test/couch_mrview_ddoc_updated_tests.erl
index d0ba6b4..cc3844d 100644
--- a/src/couch_mrview/test/couch_mrview_ddoc_updated_tests.erl
+++ b/src/couch_mrview/test/couch_mrview_ddoc_updated_tests.erl
@@ -28,7 +28,6 @@ setup() ->
             {<<"baz">>, {[
                 {<<"map">>, <<
                     "function(doc) {\n"
-                    "    var i = 0; while(i<1000){ i++ };\n"
                     "    emit(doc.val, doc.val);\n"
                     "}"
                 >>}
@@ -47,12 +46,19 @@ setup() ->
     {ok, _} =
         couch_mrview:query_view(Db2, <<"_design/bar">>, <<"baz">>,
[], CB, 0),
 
+    meck:new(couch_index_updater, [passthrough]),
+    meck:expect(couch_index_updater, update, fun(Idx, Mod, IdxSt) ->
+        timer:sleep(5000),
+        meck:passthrough([Idx, Mod, IdxSt])
+    end),
+
     % add more docs
     {ok, _} = couch_db:update_docs(Db2, Docs999, []),
     {ok, Db3} = couch_db:reopen(Db2),
     Db3.
 
 teardown(Db) ->
+    meck:unload(couch_index_updater),
     couch_db:close(Db),
     couch_server:delete(Db#db.name, [?ADMIN_CTX]),
     ok.

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message