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 2017/05/16 20:09:02 UTC
[1/2] config commit: updated refs/heads/fix-eunit-tests to a7206c7
Repository: couchdb-config
Updated Branches:
refs/heads/fix-eunit-tests [created] a7206c71b
Let test_util figure out our deps
Dependencies are already listed in config.app.src so we should just let
the test_util figure out what else needs starting.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/74728c45
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/74728c45
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/74728c45
Branch: refs/heads/fix-eunit-tests
Commit: 74728c451909fc3c369cbf0406b5ec8dadbd3c47
Parents: f62d553
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue May 16 15:06:37 2017 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue May 16 15:06:37 2017 -0500
----------------------------------------------------------------------
test/config_tests.erl | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/74728c45/test/config_tests.erl
----------------------------------------------------------------------
diff --git a/test/config_tests.erl b/test/config_tests.erl
index a0e1758..196e29f 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -50,8 +50,6 @@
FileName
end).
--define(DEPS, [couch_stats, couch_log, config]).
-
-define(T(F), {erlang:fun_to_list(F), F}).
-define(FEXT(F), fun(_, _) -> F() end).
@@ -69,7 +67,7 @@ setup({persistent, Chain}) ->
setup(Chain) ->
ok = application:set_env(config, ini_files, Chain),
- test_util:start_applications(?DEPS).
+ test_util:start_applications([config]).
setup_empty() ->
[2/2] config commit: updated refs/heads/fix-eunit-tests to a7206c7
Posted by da...@apache.org.
Make sure to stop the correct applications
We need to make sure and stop all applications that we started.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/a7206c71
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/a7206c71
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/a7206c71
Branch: refs/heads/fix-eunit-tests
Commit: a7206c71b5bcbaf2eddc89e97bb8d73711ff4564
Parents: 74728c4
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue May 16 15:07:46 2017 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue May 16 15:07:46 2017 -0500
----------------------------------------------------------------------
test/config_tests.erl | 50 ++++++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/a7206c71/test/config_tests.erl
----------------------------------------------------------------------
diff --git a/test/config_tests.erl b/test/config_tests.erl
index 196e29f..7e39b9a 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -75,26 +75,28 @@ setup_empty() ->
setup_config_listener() ->
- setup(),
- spawn_config_listener().
+ Apps = setup(),
+ Pid = spawn_config_listener(),
+ {Apps, Pid}.
setup_config_notifier(Subscription) ->
- setup(),
- spawn_config_notifier(Subscription).
+ Apps = setup(),
+ Pid = spawn_config_notifier(Subscription),
+ {Apps, Pid}.
-teardown(Pid) when is_pid(Pid) ->
+teardown({Apps, Pid}) when is_pid(Pid) ->
catch exit(Pid, kill),
- teardown(undefined);
+ teardown(Apps);
-teardown(_) ->
- [application:stop(App) || App <- ?DEPS].
+teardown(Apps) when is_list(Apps) ->
+ test_util:stop_applications(Apps).
-teardown(_, Pid) when is_pid(Pid) ->
+teardown(_, {Apps, Pid}) when is_pid(Pid) ->
catch exit(Pid, kill),
- teardown(undefined);
-teardown(_, _) ->
- teardown(undefined).
+ teardown(Apps);
+teardown(_, Apps) ->
+ teardown(Apps).
handle_config_change("remove_handler", _Key, _Value, _Persist, {_Pid, _State}) ->
@@ -445,14 +447,14 @@ should_create_persistent_option() ->
end).
-should_handle_value_change(Pid) ->
+should_handle_value_change({_Apps, Pid}) ->
?_test(begin
?assertEqual(ok, config:set("httpd", "port", "80", false)),
?assertMatch({{"httpd", "port", "80", false}, _}, getmsg(Pid))
end).
-should_pass_correct_state_to_handle_config_change(Pid) ->
+should_pass_correct_state_to_handle_config_change({_Apps, Pid}) ->
?_test(begin
?assertEqual(ok, config:set("update_state", "foo", "any", false)),
?assertMatch({_, undefined}, getmsg(Pid)),
@@ -461,7 +463,7 @@ should_pass_correct_state_to_handle_config_change(Pid) ->
end).
-should_pass_correct_state_to_handle_config_terminate(Pid) ->
+should_pass_correct_state_to_handle_config_terminate({_Apps, Pid}) ->
?_test(begin
?assertEqual(ok, config:set("update_state", "foo", "any", false)),
?assertMatch({_, undefined}, getmsg(Pid)),
@@ -472,14 +474,14 @@ should_pass_correct_state_to_handle_config_terminate(Pid) ->
end).
-should_pass_subscriber_pid_to_handle_config_terminate(Pid) ->
+should_pass_subscriber_pid_to_handle_config_terminate({_Apps, Pid}) ->
?_test(begin
?assertEqual(ok, config:set("remove_handler", "any", "any", false)),
?assertEqual({Pid, remove_handler, undefined}, getmsg(Pid))
end).
-should_not_call_handle_config_after_related_process_death(Pid) ->
+should_not_call_handle_config_after_related_process_death({_Apps, Pid}) ->
?_test(begin
?assertEqual(ok, config:set("remove_handler", "any", "any", false)),
?assertEqual({Pid, remove_handler, undefined}, getmsg(Pid)),
@@ -492,7 +494,7 @@ should_not_call_handle_config_after_related_process_death(Pid) ->
end).
-should_remove_handler_when_requested(Pid) ->
+should_remove_handler_when_requested({_Apps, Pid}) ->
?_test(begin
?assertEqual(1, n_handlers()),
?assertEqual(ok, config:set("remove_handler", "any", "any", false)),
@@ -501,7 +503,7 @@ should_remove_handler_when_requested(Pid) ->
end).
-should_remove_handler_when_pid_exits(Pid) ->
+should_remove_handler_when_pid_exits({_Apps, Pid}) ->
?_test(begin
?assertEqual(1, n_handlers()),
@@ -530,7 +532,7 @@ should_remove_handler_when_pid_exits(Pid) ->
end).
-should_stop_monitor_on_error(Pid) ->
+should_stop_monitor_on_error({_Apps, Pid}) ->
?_test(begin
?assertEqual(1, n_handlers()),
@@ -556,27 +558,27 @@ should_stop_monitor_on_error(Pid) ->
?assertEqual(0, n_handlers())
end).
-should_notify(Subscription, Pid) ->
+should_notify(Subscription, {_Apps, Pid}) ->
{to_string(Subscription), ?_test(begin
?assertEqual(ok, config:set("section_foo", "key_bar", "any", false)),
?assertEqual({config_change,"section_foo", "key_bar", "any", false}, getmsg(Pid)),
ok
end)}.
-should_not_notify([{Section, _}] = Subscription, Pid) ->
+should_not_notify([{Section, _}] = Subscription, {_Apps, Pid}) ->
{to_string(Subscription), ?_test(begin
?assertEqual(ok, config:set(Section, "any", "any", false)),
?assertError({timeout, config_msg}, getmsg(Pid)),
ok
end)};
-should_not_notify(Subscription, Pid) ->
+should_not_notify(Subscription, {_Apps, Pid}) ->
{to_string(Subscription), ?_test(begin
?assertEqual(ok, config:set("any", "any", "any", false)),
?assertError({timeout, config_msg}, getmsg(Pid)),
ok
end)}.
-should_unsubscribe_when_subscriber_gone(_Subscription, Pid) ->
+should_unsubscribe_when_subscriber_gone(_Subscription, {_Apps, Pid}) ->
?_test(begin
?assertEqual(1, n_notifiers()),