couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] branch 63012-scheduler updated: [fixup] multidb changes test fixes
Date Mon, 10 Apr 2017 17:23:53 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 63012-scheduler
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/63012-scheduler by this push:
       new  a273123   [fixup] multidb changes test fixes
a273123 is described below

commit a273123c1c491031b63403b48fb0ac66e5343cd1
Author: Nick Vatamaniuc <vatamane@apache.org>
AuthorDate: Mon Apr 10 13:23:45 2017 -0400

    [fixup] multidb changes test fixes
---
 src/couch_replicator/src/couch_multidb_changes.erl | 23 ++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/couch_replicator/src/couch_multidb_changes.erl b/src/couch_replicator/src/couch_multidb_changes.erl
index ba624a4..b9cddd1 100644
--- a/src/couch_replicator/src/couch_multidb_changes.erl
+++ b/src/couch_replicator/src/couch_multidb_changes.erl
@@ -375,8 +375,8 @@ setup() ->
         end),
     meck:expect(couch_db, close, 1, ok),
     mock_changes_reader(),
-    % create process to stand in for couch_ever_server
-    % mocking erlang:monitor doesn't, so give it real process to monitor
+    % create process to stand in for couch_event_server
+    % mocking erlang:monitor doesn't work, so give it real process to monitor
     EvtPid = spawn_link(fun() -> receive looper -> ok end end),
     true = register(couch_event_server, EvtPid),
     EvtPid.
@@ -461,7 +461,10 @@ t_handle_info_updated() ->
 t_handle_info_other_event() ->
      ?_test(begin
         State = mock_state(),
-        handle_info_check({'$couch_event', ?DBNAME, somethingelse}, State)
+        handle_info_check({'$couch_event', ?DBNAME, somethingelse}, State),
+        ?assertNot(meck:called(?MOD, db_created, [?DBNAME, somethingelse])),
+        ?assertNot(meck:called(?MOD, db_deleted, [?DBNAME, somethingelse])),
+        ?assertNot(meck:called(?MOD, db_found, [?DBNAME, somethingelse]))
     end).
 
 
@@ -539,7 +542,7 @@ t_handle_info_change_feed_exited_and_need_rescan() ->
         % a mock change feed process should be running
         [{?DBNAME, Pid}] = RState#state.pids,
         ?assert(is_pid(Pid)),
-        ChArgs = kill_mock_change_reader_and_get_its_args(Pid),
+        ChArgs = kill_mock_changes_reader_and_get_its_args(Pid),
         ?assertEqual({self(), ?DBNAME}, ChArgs),
         ets:delete(Tid)
     end).
@@ -549,7 +552,7 @@ t_spawn_changes_reader() ->
     ?_test(begin
         Pid = start_changes_reader(?DBNAME, 3),
         ?assert(erlang:is_process_alive(Pid)),
-        ChArgs = kill_mock_change_reader_and_get_its_args(Pid),
+        ChArgs = kill_mock_changes_reader_and_get_its_args(Pid),
         ?assertEqual({self(), ?DBNAME}, ChArgs),
         ?assert(meck:validate(couch_db)),
         ?assert(meck:validate(couch_changes)),
@@ -604,7 +607,7 @@ t_handle_call_resume_scan_no_chfeed_no_ets_entry() ->
         ?assert(meck:called(?MOD, db_found, [?DBNAME, zig])),
         % Check if started a change reader
         [{?DBNAME, Pid}] = RState#state.pids,
-        ChArgs = kill_mock_change_reader_and_get_its_args(Pid),
+        ChArgs = kill_mock_changes_reader_and_get_its_args(Pid),
         ?assertEqual({self(), ?DBNAME}, ChArgs),
         ?assert(meck:called(couch_changes, handle_db_changes, [
               #changes_args{
@@ -626,7 +629,7 @@ t_handle_call_resume_scan_chfeed_no_ets_entry() ->
         % Check ets checkpoint is set to 0 and rescan = true
         ?assertEqual([{?DBNAME, 0, true}], ets:tab2list(Tid)),
         ets:delete(Tid),
-        kill_mock_change_reader_and_get_its_args(Pid)
+        kill_mock_changes_reader_and_get_its_args(Pid)
     end).
 
 
@@ -640,7 +643,7 @@ t_handle_call_resume_scan_chfeed_ets_entry() ->
         % Check ets checkpoint is set to same endseq but rescan = true
         ?assertEqual([{?DBNAME, 2, true}], ets:tab2list(Tid)),
         ets:delete(Tid),
-        kill_mock_change_reader_and_get_its_args(Pid)
+        kill_mock_changes_reader_and_get_its_args(Pid)
     end).
 
 
@@ -654,7 +657,7 @@ t_handle_call_resume_scan_no_chfeed_ets_entry() ->
         ?assertEqual([{?DBNAME, 1, false}], ets:tab2list(Tid)),
         % Check if started a change reader
         [{?DBNAME, Pid}] = RState#state.pids,
-        ChArgs = kill_mock_change_reader_and_get_its_args(Pid),
+        ChArgs = kill_mock_changes_reader_and_get_its_args(Pid),
         ?assertEqual({self(), ?DBNAME}, ChArgs),
         ?assert(meck:called(couch_changes, handle_db_changes, [
             #changes_args{
@@ -794,7 +797,7 @@ mock_changes_reader_loop({_CbFun, {Server, DbName}}) ->
             exit({Server, DbName})
     end.
 
-kill_mock_change_reader_and_get_its_args(Pid) ->
+kill_mock_changes_reader_and_get_its_args(Pid) ->
     Ref = monitor(process, Pid),
     unlink(Pid),
     Pid ! die,

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

Mime
View raw message