diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2019-12-25 11:39:22 -0600 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2019-12-25 13:52:32 -0600 |
commit | 40b42af9fbbc812cc185389b7e41d3228b91642a (patch) | |
tree | a26f53cf7fba61edee7374eb828ffbc34d2dde73 | |
parent | b00ea30457ee6d78fe8de7c8d124a1c6f4eee725 (diff) | |
download | couchdb-40b42af9fbbc812cc185389b7e41d3228b91642a.tar.gz |
Speedup eunit: couch_replicator_clustering
-rw-r--r-- | src/couch_replicator/src/couch_replicator_clustering.erl | 39 |
1 files 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 a7f7573b6..3ea693465 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. |