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:33 UTC
[couchdb] 30/41: Speedup eunit: couch_replicator_clustering
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 cb455cd8416bae34e49e3a9b799b60bff02b2855
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Dec 25 11:39:22 2019 -0600
Speedup eunit: couch_replicator_clustering
---
.../src/couch_replicator_clustering.erl | 39 ++++++++++++++++------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/couch_replicator/src/couch_replicator_clustering.erl b/src/couch_replicator/src/couch_replicator_clustering.erl
index a7f7573..3ea6934 100644
--- a/src/couch_replicator/src/couch_replicator_clustering.erl
+++ b/src/couch_replicator/src/couch_replicator_clustering.erl
@@ -203,13 +203,18 @@ owner_int(ShardName, DocId) ->
replicator_clustering_test_() ->
{
- foreach,
- fun setup/0,
- fun teardown/1,
- [
- t_stable_callback(),
- t_unstable_callback()
- ]
+ setup,
+ fun setup_all/0,
+ fun teardown_all/1,
+ {
+ foreach,
+ fun setup/0,
+ fun teardown/1,
+ [
+ t_stable_callback(),
+ t_unstable_callback()
+ ]
+ }
}.
@@ -230,19 +235,31 @@ t_unstable_callback() ->
end).
-setup() ->
+setup_all() ->
meck:expect(couch_log, notice, 2, ok),
meck:expect(config, get, fun(_, _, Default) -> Default end),
meck:expect(config, listen_for_changes, 2, ok),
meck:expect(couch_stats, update_gauge, 2, ok),
- meck:expect(couch_replicator_notifier, notify, 1, ok),
+ meck:expect(couch_replicator_notifier, notify, 1, ok).
+
+
+teardown_all(_) ->
+ meck:unload().
+
+
+setup() ->
+ meck:reset([
+ config,
+ couch_log,
+ couch_stats,
+ couch_replicator_notifier
+ ]),
{ok, Pid} = start_link(),
Pid.
teardown(Pid) ->
unlink(Pid),
- exit(Pid, kill),
- meck:unload().
+ exit(Pid, kill).
-endif.