diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2019-12-25 11:36:49 -0600 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2019-12-25 13:52:32 -0600 |
commit | 28fd3cdffb1b24a5a3ba0dc6c6d6b22de981caa0 (patch) | |
tree | 341f0b46fc13bdf09d2966c39446d83099820ef6 | |
parent | 006b706daa5da67a809bacd23b68d7f95770b9ee (diff) | |
download | couchdb-28fd3cdffb1b24a5a3ba0dc6c6d6b22de981caa0.tar.gz |
Speedup eunit: couch_index_compaction_tests
-rw-r--r-- | src/couch_index/test/eunit/couch_index_compaction_tests.erl | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/couch_index/test/eunit/couch_index_compaction_tests.erl b/src/couch_index/test/eunit/couch_index_compaction_tests.erl index 53316d944..ab493a969 100644 --- a/src/couch_index/test/eunit/couch_index_compaction_tests.erl +++ b/src/couch_index/test/eunit/couch_index_compaction_tests.erl @@ -17,6 +17,16 @@ -define(WAIT_TIMEOUT, 1000). + +setup_all() -> + Ctx = test_util:start_couch(), + meck:new([test_index], [non_strict]), + Ctx. + +teardown_all(Ctx) -> + meck:unload(), + test_util:stop_couch(Ctx). + setup() -> DbName = ?tempdb(), {ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]), @@ -27,7 +37,6 @@ setup() -> {Db, IndexerPid}. fake_index(DbName) -> - ok = meck:new([test_index], [non_strict]), ok = meck:expect(test_index, init, ['_', '_'], {ok, 10}), ok = meck:expect(test_index, open, fun(_Db, State) -> {ok, State} @@ -51,17 +60,19 @@ fake_index(DbName) -> end). teardown(_) -> - meck:unload(test_index). + ok. compaction_test_() -> { "Check compaction", { setup, - fun() -> test_util:start_couch([]) end, fun test_util:stop_couch/1, + fun setup_all/0, + fun teardown_all/1, { foreach, - fun setup/0, fun teardown/1, + fun setup/0, + fun teardown/1, [ fun hold_db_for_recompaction/1 ] |