You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/02/04 16:49:37 UTC

[2/5] config commit: updated refs/heads/master to b281825

Change setup/teardown logic and enable some tests

COUCHDB-2561


Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/ee24f3ef
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/ee24f3ef
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/ee24f3ef

Branch: refs/heads/master
Commit: ee24f3ef1a40c1441852dea41061998ac30eb3de
Parents: e19b7d5
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Thu Jan 29 12:53:11 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Thu Jan 29 14:19:59 2015 -0800

----------------------------------------------------------------------
 test/config_tests.erl | 49 +++++++++++++++++++++-------------------------
 1 file changed, 22 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/ee24f3ef/test/config_tests.erl
----------------------------------------------------------------------
diff --git a/test/config_tests.erl b/test/config_tests.erl
index 636cb05..dcfb071 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -33,7 +33,8 @@
         FileName
     end).
 
--define(DEPS, [couch_stats, couch_log, folsom, lager, goldrush, syntax_tools, compiler]).
+-define(DEPS, [couch_stats, couch_log, folsom, lager,
+               goldrush, syntax_tools, compiler, config]).
 
 
 setup() ->
@@ -43,37 +44,31 @@ setup({temporary, Chain}) ->
 setup({persistent, Chain}) ->
     setup(lists:append(Chain, [?CONFIG_FIXTURE_TEMP]));
 setup(Chain) ->
-    [ok = application:start(App) || App <- lists:reverse(?DEPS)],
-    {ok, Pid} = test_util:start_config(Chain),
-    Pid.
+    ok = application:set_env(config, ini_files, Chain),
+    test_util:start_applications(?DEPS).
 
 setup_empty() ->
     setup([]).
 
-teardown(Pid) ->
-    config:stop(),
-    [ok = application:stop(App) || App <- ?DEPS],
-    erlang:monitor(process, Pid),
-    receive
-        {'DOWN', _, _, Pid, _} ->
-            ok
-    after ?TIMEOUT ->
-        throw({timeout_error, config_stop})
-    end.
-teardown(_, Pid) ->
-    teardown(Pid).
+teardown({Pid, _}) ->
+    stop_listener(Pid),
+    [application:stop(App) || App <- ?DEPS];
+teardown(_) ->
+    [application:stop(App) || App <- ?DEPS].
 
+teardown(_, _) ->
+    [application:stop(App) || App <- ?DEPS].
 
 config_test_() ->
     {
         "CouchDB config tests",
         [
             config_get_tests(),
-            %% config_set_tests(),
-            %% config_del_tests(),
-            config_override_tests()
-            %% config_persistent_changes_tests(),
-            %% config_no_files_tests()
+            config_set_tests(),
+            config_del_tests(),
+            config_override_tests(),
+            config_persistent_changes_tests(),
+            config_no_files_tests()
         ]
     }.
 
@@ -90,8 +85,8 @@ config_get_tests() ->
                 should_return_undefined_atom_on_missed_section(),
                 should_return_undefined_atom_on_missed_option(),
                 should_return_custom_default_value_on_missed_option(),
-                should_only_return_default_on_missed_option(),
-                should_get_binary_option()
+                should_only_return_default_on_missed_option()%,
+                %%should_get_binary_option()
             ]
         }
     }.
@@ -104,8 +99,8 @@ config_set_tests() ->
             fun setup/0, fun teardown/1,
             [
                 should_update_option(),
-                should_create_new_section(),
-                should_set_binary_option()
+                should_create_new_section()%,
+                %%should_set_binary_option()
             ]
         }
     }.
@@ -118,8 +113,8 @@ config_del_tests() ->
             fun setup/0, fun teardown/1,
             [
                 should_return_undefined_atom_after_option_deletion(),
-                should_be_ok_on_deleting_unknown_options(),
-                should_delete_binary_option()
+                should_be_ok_on_deleting_unknown_options()%,
+                %%should_delete_binary_option()
             ]
         }
     }.