You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/06/02 21:35:42 UTC

[11/50] couch commit: updated refs/heads/2080-port-cors-to-chttpd to 529339b

Make sure we load all applications with stats defs

couch_stats app relies on application:loaded_applications.
While in the test suite we have to load the apps manually
prior to start couch_stats app.
Note: We are just loading deps but not starting them.
The commit is also needed for COUCHDB-2552.

COUCHDB-2547


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

Branch: refs/heads/2080-port-cors-to-chttpd
Commit: d8d1a3ca0e3fe7ba6cdeced111f868a8e20fbccf
Parents: d48664f
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Tue Feb 10 11:39:00 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Feb 10 11:39:00 2015 -0800

----------------------------------------------------------------------
 src/test_util.erl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/d8d1a3ca/src/test_util.erl
----------------------------------------------------------------------
diff --git a/src/test_util.erl b/src/test_util.erl
index 48b57f0..829fc36 100644
--- a/src/test_util.erl
+++ b/src/test_util.erl
@@ -67,6 +67,7 @@ start_couch(ExtraApps) ->
     start_couch(?CONFIG_CHAIN, ExtraApps).
 
 start_couch(IniFiles, ExtraApps) ->
+    load_applications_with_stats(),
     ok = application:set_env(config, ini_files, IniFiles),
     ok = lager:start(),
 
@@ -74,7 +75,6 @@ start_couch(IniFiles, ExtraApps) ->
         [inets, ibrowse, ssl, config, couch_event, couch]
         ++ ExtraApps),
 
-    couch_stats:reload(),
     #test_context{started = Apps}.
 
 stop_couch() ->
@@ -254,3 +254,12 @@ mock(couch_stats) ->
     meck:expect(couch_stats, update_histogram, fun(_, _) -> ok end),
     meck:expect(couch_stats, update_gauge, fun(_, _) -> ok end),
     ok.
+
+load_applications_with_stats() ->
+    Wildcard = filename:join([?BUILDDIR(), "src/*/priv/stats_descriptions.cfg"]),
+    [application:load(stats_file_to_app(File)) || File <- filelib:wildcard(Wildcard)],
+    ok.
+
+stats_file_to_app(File) ->
+    [_Desc, _Priv, App|_] = lists:reverse(filename:split(File)),
+    erlang:list_to_atom(App).