You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/07/25 22:38:38 UTC

[couchdb] branch master updated: Fix regression test for COUCHDB-1283

This is an automated email from the ASF dual-hosted git repository.

davisp 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 439e642  Fix regression test for COUCHDB-1283
439e642 is described below

commit 439e642363cbb7bbc299b844df211e849aa667a8
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue Jul 25 16:41:59 2017 -0500

    Fix regression test for COUCHDB-1283
    
    This makes sure that we correctly synchronize with the process running
    compaction before we perform our desired assertions.
    
    Fixes #701
---
 src/couch/test/couchdb_views_tests.erl | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/couch/test/couchdb_views_tests.erl b/src/couch/test/couchdb_views_tests.erl
index 616a3c8..65fc2b3 100644
--- a/src/couch/test/couchdb_views_tests.erl
+++ b/src/couch/test/couchdb_views_tests.erl
@@ -354,19 +354,30 @@ couchdb_1283() ->
             couch_mrview_index, MDb1#db.name, <<"_design/foo">>),
 
         % Start and pause compacton
+        WaitRef = erlang:make_ref(),
+        meck:expect(couch_mrview_index, compact, fun(Db, State, Opts) ->
+            receive {WaitRef, From, init} -> ok end,
+            From ! {WaitRef, inited},
+            receive {WaitRef, go} -> ok end,
+            meck:passthrough([Db, State, Opts])
+        end),
+
         {ok, CPid} = gen_server:call(Pid, compact),
-        meck:wait(couch_mrview_index, compact, ['_', '_', '_'], 1000),
-        erlang:suspend_process(CPid),
         CRef = erlang:monitor(process, CPid),
         ?assert(is_process_alive(CPid)),
 
+        % Make sure that our compactor is waiting for us
+        % before we continue our assertions
+        CPid ! {WaitRef, self(), init},
+        receive {WaitRef, inited} -> ok end,
+
         % Make sure that a compaction process takes a monitor
         % on the database's main_pid
         ?assertEqual(true, lists:member(CPid, couch_db:monitored_by(MDb1))),
 
         % Finish compaction to and make sure the monitor
         % disappears
-        erlang:resume_process(CPid),
+        CPid ! {WaitRef, go},
         wait_for_process_shutdown(CRef, normal,
           {reason, "Failure compacting view group"}),
 

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