couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [2/6] config commit: updated refs/heads/master to 47e5f70
Date Tue, 23 Aug 2016 22:04:23 GMT
Consider only needed handlers in n_handlers

When testing. Make sure we don't count other config_event handlers
present in the system.


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

Branch: refs/heads/master
Commit: bf7b3e1690e17dc5ee7d8e70067cd6843e52157c
Parents: 12dcbf5
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Aug 15 16:55:09 2016 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Thu Aug 18 13:08:21 2016 -0700

----------------------------------------------------------------------
 test/config_tests.erl | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/bf7b3e16/test/config_tests.erl
----------------------------------------------------------------------
diff --git a/test/config_tests.erl b/test/config_tests.erl
index 311a805..ac57f21 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -454,16 +454,16 @@ should_not_call_handle_config_after_related_process_death(Pid) ->
 
 should_remove_handler_when_requested(Pid) ->
     ?_test(begin
-        ?assertEqual(2, n_handlers()),
+        ?assertEqual(1, n_handlers()),
         ?assertEqual(ok, config:set("remove_handler", "any", "any", false)),
         ?assertEqual({Pid, remove_handler, undefined}, getmsg(Pid)),
-        ?assertEqual(1, n_handlers())
+        ?assertEqual(0, n_handlers())
     end).
 
 
 should_remove_handler_when_pid_exits(Pid) ->
     ?_test(begin
-        ?assertEqual(2, n_handlers()),
+        ?assertEqual(1, n_handlers()),
 
         % Monitor the config_listener_mon process
         {monitored_by, [Mon]} = process_info(Pid, monitored_by),
@@ -486,13 +486,13 @@ should_remove_handler_when_pid_exits(Pid) ->
             erlang:error({timeout, config_listener_mon_death})
         end,
 
-        ?assertEqual(1, n_handlers())
+        ?assertEqual(0, n_handlers())
     end).
 
 
 should_stop_monitor_on_error(Pid) ->
     ?_test(begin
-        ?assertEqual(2, n_handlers()),
+        ?assertEqual(1, n_handlers()),
 
         % Monitor the config_listener_mon process
         {monitored_by, [Mon]} = process_info(Pid, monitored_by),
@@ -513,7 +513,7 @@ should_stop_monitor_on_error(Pid) ->
             erlang:error({timeout, config_listener_mon_shutdown})
         end,
 
-        ?assertEqual(1, n_handlers())
+        ?assertEqual(0, n_handlers())
     end).
 
 
@@ -572,4 +572,5 @@ getmsg(Pid) ->
 
 
 n_handlers() ->
-    length(gen_event:which_handlers(config_event)).
+    Handlers = gen_event:which_handlers(config_event),
+    length([Pid || {config_listener, {?MODULE, Pid}} <- Handlers]).


Mime
View raw message