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 2019/12/25 17:45:37 UTC

[couchdb] 34/41: Speedup eunit: fabric_doc_open

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

davisp pushed a commit to branch speedup-test-suite
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 6e9c55490f642ae4fb17ee7a3d38075df9ce7388
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Dec 25 11:40:48 2019 -0600

    Speedup eunit: fabric_doc_open
---
 src/fabric/src/fabric_doc_open.erl | 61 ++++++++++++++++++++++++--------------
 1 file changed, 38 insertions(+), 23 deletions(-)

diff --git a/src/fabric/src/fabric_doc_open.erl b/src/fabric/src/fabric_doc_open.erl
index 743ad8c7..8ef604b 100644
--- a/src/fabric/src/fabric_doc_open.erl
+++ b/src/fabric/src/fabric_doc_open.erl
@@ -185,38 +185,53 @@ format_reply(Else, _) ->
 -ifdef(TEST).
 -include_lib("eunit/include/eunit.hrl").
 
+-define(MECK_MODS, [
+    couch_log,
+    couch_stats,
+    fabric,
+    fabric_util,
+    mem3,
+    rexi,
+    rexi_monitor
+]).
+
+
+setup_all() ->
+    meck:new(?MECK_MODS, [passthrough]).
+
+
+teardown_all(_) ->
+    meck:unload().
+
 
 setup() ->
-    meck:new([
-        couch_log,
-        couch_stats,
-        fabric,
-        fabric_util,
-        mem3,
-        rexi,
-        rexi_monitor
-    ], [passthrough]).
+    meck:reset(?MECK_MODS).
 
 
 teardown(_) ->
-    meck:unload().
+    ok.
 
 
 open_doc_test_() ->
     {
-        foreach,
-        fun setup/0,
-        fun teardown/1,
-        [
-            t_is_r_met(),
-            t_handle_message_down(),
-            t_handle_message_exit(),
-            t_handle_message_reply(),
-            t_store_node_revs(),
-            t_read_repair(),
-            t_handle_response_quorum_met(),
-            t_get_doc_info()
-        ]
+        setup,
+        fun setup_all/0,
+        fun teardown_all/1,
+        {
+            foreach,
+            fun setup/0,
+            fun teardown/1,
+            [
+                t_is_r_met(),
+                t_handle_message_down(),
+                t_handle_message_exit(),
+                t_handle_message_reply(),
+                t_store_node_revs(),
+                t_read_repair(),
+                t_handle_response_quorum_met(),
+                t_get_doc_info()
+            ]
+        }
     }.