summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-25 11:43:17 -0600
committerPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-25 13:52:32 -0600
commit19c67e1e52a4071e1c41e6c36cf6b6ddd2e448e2 (patch)
tree0c8047fa73d8b0ca9978c24cc92b4754a9dc75d6
parent2f6de6d881c47cf1236a8fbbb8ef24afb63ea685 (diff)
downloadcouchdb-19c67e1e52a4071e1c41e6c36cf6b6ddd2e448e2.tar.gz
Speedup eunit: smoosh_server
-rw-r--r--src/smoosh/src/smoosh_server.erl45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/smoosh/src/smoosh_server.erl b/src/smoosh/src/smoosh_server.erl
index 43f4bd8e2..7af1e4eef 100644
--- a/src/smoosh/src/smoosh_server.erl
+++ b/src/smoosh/src/smoosh_server.erl
@@ -446,18 +446,22 @@ needs_upgrade(Props) ->
-include_lib("eunit/include/eunit.hrl").
-setup() ->
+setup_all() ->
meck:new([config, couch_index, couch_index_server], [passthrough]),
Pid = list_to_pid("<0.0.0>"),
meck:expect(couch_index_server, get_index, 3, {ok, Pid}),
- meck:expect(config, get, fun(_, _, Default) -> Default end),
+ meck:expect(config, get, fun(_, _, Default) -> Default end).
+
+teardown_all(_) ->
+ meck:unload().
+
+setup() ->
Shard = <<"shards/00000000-1fffffff/test.1529510412">>,
GroupId = <<"_design/ddoc">>,
{ok, Shard, GroupId}.
-
teardown(_) ->
- meck:unload().
+ ok.
config_change_test_() ->
{
@@ -474,20 +478,25 @@ config_change_test_() ->
get_priority_test_() ->
{
- foreach,
- fun setup/0,
- fun teardown/1,
- [
- fun t_ratio_view/1,
- fun t_slack_view/1,
- fun t_no_data_view/1,
- fun t_below_min_priority_view/1,
- fun t_below_min_size_view/1,
- fun t_timeout_view/1,
- fun t_missing_view/1,
- fun t_invalid_view/1
- ]
-}.
+ setup,
+ fun setup_all/0,
+ fun teardown_all/1,
+ {
+ foreach,
+ fun setup/0,
+ fun teardown/1,
+ [
+ fun t_ratio_view/1,
+ fun t_slack_view/1,
+ fun t_no_data_view/1,
+ fun t_below_min_priority_view/1,
+ fun t_below_min_size_view/1,
+ fun t_timeout_view/1,
+ fun t_missing_view/1,
+ fun t_invalid_view/1
+ ]
+ }
+ }.
t_restart_config_listener(_) ->
?_test(begin