couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couch commit: updated refs/heads/master to 853177c
Date Fri, 06 Nov 2015 15:46:59 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master acfd7cb0c -> 853177ca4


Run tests with only the couch_db_plugin_test couch_epi plugin

These tests should only be run with the single couch_epi plugin defined by the test suite
itself.
Also, only setup/teardown once for entire suite to improve performance.

COUCHDB-2868


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

Branch: refs/heads/master
Commit: 853177ca42160e572610cfec5c9c9f5ded9ecedf
Parents: acfd7cb
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Thu Nov 5 13:42:05 2015 -0800
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Thu Nov 5 13:42:05 2015 -0800

----------------------------------------------------------------------
 test/couch_db_plugin_tests.erl | 32 +++++++++-----------------------
 1 file changed, 9 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/853177ca/test/couch_db_plugin_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_db_plugin_tests.erl b/test/couch_db_plugin_tests.erl
index 77d9529..3222eb0 100644
--- a/test/couch_db_plugin_tests.erl
+++ b/test/couch_db_plugin_tests.erl
@@ -34,8 +34,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--record(ctx, {pid, handle}).
-
 %% couch_epi_plugin behaviour
 
 app() -> test_app.
@@ -46,28 +44,16 @@ data_subscriptions() -> [].
 processes() -> [].
 notify(_, _, _) -> ok.
 
-start_epi() ->
-    application:load(couch_epi),
-    Plugins = application:get_env(couch_epi, plugins, []),
-    ok = application:set_env(couch_epi, plugins, append_if_missing(Plugins, ?MODULE)),
-    ok = application:start(couch_epi).
-
-append_if_missing(List, Value) ->
-    case lists:member(Value, List) of
-        true -> List;
-        false -> [Value | List]
-    end.
-
 setup() ->
-    error_logger:tty(false),
-    start_epi(),
-    #ctx{handle = couch_epi:get_handle(couch_db)}.
+    application:stop(couch_epi), % in case it's already running from other tests...
+    application:unload(couch_epi),
+    ok = application:load(couch_epi),
+    ok = application:set_env(couch_epi, plugins, [?MODULE]), % only this plugin
+    ok = application:start(couch_epi).
 
-teardown(#ctx{}) ->
-    Plugins = application:get_env(couch_epi, plugins, []),
-    application:set_env(couch_epi, plugins, Plugins -- [?MODULE]),
-    application:stop(couch_epi),
-    ok.
+teardown(_) ->
+    ok = application:stop(couch_epi),
+    ok = application:unload(couch_epi).
 
 validate_dbname({true, _Db}, _) -> true;
 validate_dbname({false, _Db}, _) -> false;
@@ -97,7 +83,7 @@ callback_test_() ->
     {
         "callback tests",
         {
-            foreach, fun setup/0, fun teardown/1,
+            setup, fun setup/0, fun teardown/1,
             [
                 fun validate_dbname_match/0,
                 fun validate_dbname_no_match/0,


Mime
View raw message