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:30 UTC

[couchdb] 27/41: Speedup eunit: couch_mrview_purge_docs_fabric_tests

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 7d11ba7aa7938a19c4d31c64ba1bcf8e400a6791
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Dec 25 11:37:39 2019 -0600

    Speedup eunit: couch_mrview_purge_docs_fabric_tests
---
 .../eunit/couch_mrview_purge_docs_fabric_tests.erl     | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
index a593f54..b2969bb 100644
--- a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
+++ b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
@@ -20,10 +20,21 @@
 -define(TIMEOUT, 60). % seconds
 
 
+setup_all() ->
+    Ctx = test_util:start_couch([fabric, mem3]),
+    meck:new(couch_mrview_index, [passthrough]),
+    Ctx.
+
+
+teardown_all(Ctx) ->
+    meck:unload(),
+    test_util:stop_couch(Ctx).
+
+
 setup() ->
     DbName = ?tempdb(),
     ok = fabric:create_db(DbName, [?ADMIN_CTX, {q, 1}]),
-    meck:new(couch_mrview_index, [passthrough]),
+    meck:reset([couch_mrview_index]),
     meck:expect(couch_mrview_index, ensure_local_purge_docs, fun(A, B) ->
         meck:passthrough([A, B])
     end),
@@ -31,7 +42,6 @@ setup() ->
 
 
 teardown(DbName) ->
-    meck:unload(),
     ok = fabric:delete_db(DbName, [?ADMIN_CTX]).
 
 
@@ -40,8 +50,8 @@ view_purge_fabric_test_() ->
         "Map views",
         {
             setup,
-            fun() -> test_util:start_couch([fabric, mem3]) end,
-            fun test_util:stop_couch/1,
+            fun setup_all/0,
+            fun teardown_all/1,
             {
                 foreach,
                 fun setup/0,