couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject couch-log commit: updated refs/heads/master to c73efdc
Date Wed, 10 Aug 2016 21:43:56 GMT
Repository: couchdb-couch-log
Updated Branches:
  refs/heads/master afe8375e0 -> c73efdc2a


Fix test for new config listener API

The old config listeners didn't include a PID to identify which process
corresponded to a given handler. This adjusts for that.

COUCHDB-3069


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

Branch: refs/heads/master
Commit: c73efdc2ac3fed52aef0d9f94d62d8badeac82b1
Parents: afe8375
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Wed Aug 10 16:43:20 2016 -0500
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Wed Aug 10 16:43:20 2016 -0500

----------------------------------------------------------------------
 test/couch_log_config_listener_test.erl | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/c73efdc2/test/couch_log_config_listener_test.erl
----------------------------------------------------------------------
diff --git a/test/couch_log_config_listener_test.erl b/test/couch_log_config_listener_test.erl
index 9a8e16d..e607164 100644
--- a/test/couch_log_config_listener_test.erl
+++ b/test/couch_log_config_listener_test.erl
@@ -17,9 +17,6 @@
 -include_lib("eunit/include/eunit.hrl").
 
 
--define(HANDLER, {config_listener, couch_log_config_listener}).
-
-
 couch_log_config_test_() ->
     {setup,
         fun couch_log_test_util:start/0,
@@ -32,18 +29,11 @@ couch_log_config_test_() ->
 
 
 check_restart_listener() ->
-    Handlers1 = gen_event:which_handlers(config_event),
-    ?assert(lists:member(?HANDLER, Handlers1)),
-
-    gen_event:delete_handler(config_event, ?HANDLER, testing),
-
-    Handlers2 = gen_event:which_handlers(config_event),
-    ?assert(not lists:member(?HANDLER, Handlers2)),
-
+    ?assertNotEqual(not_found, get_handler()),
+    gen_event:delete_handler(config_event, get_handler(), testing),
+    ?assertEqual(not_found, get_handler()),
     timer:sleep(1000),
-
-    Handlers3 = gen_event:which_handlers(config_event),
-    ?assert(lists:member(?HANDLER, Handlers3)).
+    ?assertNotEqual(not_found, get_handler()).
 
 
 check_ignore_non_log() ->
@@ -54,3 +44,13 @@ check_ignore_non_log() ->
         end)
     end,
     ?assertError(config_change_timeout, Run()).
+
+
+get_handler() ->
+    FoldFun = fun
+        ({config_listener, {couch_log_config_listener, _}} = H, not_found) ->
+            H;
+        (_, Acc) ->
+            Acc
+    end,
+    lists:foldl(FoldFun, not_found, gen_event:which_handlers(config_event)).


Mime
View raw message