You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2013/06/29 17:18:06 UTC
[25/50] [abbrv] Major change to use the new config app
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_index/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 8c76a62..a106f14 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -12,13 +12,17 @@
-module(couch_index_server).
-behaviour(gen_server).
+-behaviour(config_listener).
-export([start_link/0, get_index/4, get_index/3, get_index/2]).
--export([config_change/2, update_notify/1]).
+-export([update_notify/1]).
-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
+% config_listener api
+-export([handle_config_change/5]).
+
-include_lib("couch/include/couch_db.hrl").
-define(BY_SIG, couchdb_indexes_by_sig).
@@ -81,14 +85,14 @@ get_index(Module, IdxState) ->
init([]) ->
process_flag(trap_exit, true),
- couch_config:register(fun ?MODULE:config_change/2),
+ ok = config:listen_for_changes(?MODULE, nil),
ets:new(?BY_SIG, [protected, set, named_table]),
ets:new(?BY_PID, [private, set, named_table]),
ets:new(?BY_DB, [protected, bag, named_table]),
couch_db_update_notifier:start_link(fun ?MODULE:update_notify/1),
RootDir = couch_index_util:root_dir(),
% Deprecation warning if it wasn't index_dir
- case couch_config:get("couchdb", "index_dir") of
+ case config:get("couchdb", "index_dir") of
undefined ->
Msg = "Deprecation warning: 'view_index_dir' is now 'index_dir'",
?LOG_ERROR(Msg, []);
@@ -137,6 +141,12 @@ handle_cast({reset_indexes, DbName}, State) ->
{noreply, State}.
+handle_info({gen_event_EXIT, {config_listener, ?MODULE}, _Reason}, State) ->
+ erlang:send_after(5000, self(), restart_config_listener),
+ {noreply, State};
+handle_info(restart_config_listener, State) ->
+ ok = config:listen_for_changes(?MODULE, State#st.root_dir),
+ {noreply, State};
handle_info({'EXIT', Pid, Reason}, Server) ->
case ets:lookup(?BY_PID, Pid) of
[{Pid, {DbName, Sig}}] ->
@@ -158,6 +168,19 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
+handle_config_change("couchdb", "index_dir", RootDir, _, RootDir) ->
+ {ok, RootDir};
+handle_config_change("couchdb", "view_index_dir", RootDir, _, RootDir) ->
+ {ok, RootDir};
+handle_config_change("couchdb", "index_dir", _, _, _) ->
+ exit(whereis(couch_index_server), config_change),
+ remove_handler;
+handle_config_change("couchdb", "view_index_dir", _, _, _) ->
+ exit(whereis(couch_index_server), config_change),
+ remove_handler;
+handle_config_change(_, _, _, _, RootDir) ->
+ {ok, RootDir}.
+
new_index({Mod, IdxState, DbName, Sig}) ->
DDocId = Mod:get(idx_name, IdxState),
case couch_index:start_link({Mod, IdxState}) of
@@ -197,12 +220,6 @@ rem_from_ets(DbName, Sig, DDocId, Pid) ->
ets:delete_object(?BY_DB, {DbName, {DDocId, Sig}}).
-config_change("couchdb", "view_index_dir") ->
- exit(whereis(?MODULE), config_change);
-config_change("couchdb", "index_dir") ->
- exit(whereis(?MODULE), config_change).
-
-
update_notify({deleted, DbName}) ->
gen_server:cast(?MODULE, {reset_indexes, DbName});
update_notify({created, DbName}) ->
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_index/src/couch_index_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_index/src/couch_index_util.erl b/src/couch_index/src/couch_index_util.erl
index cef05f5..cf1ff75 100644
--- a/src/couch_index/src/couch_index_util.erl
+++ b/src/couch_index/src/couch_index_util.erl
@@ -19,8 +19,8 @@
root_dir() ->
- case couch_config:get("couchdb", "index_dir") of
- undefined -> couch_config:get("couchdb", "view_index_dir");
+ case config:get("couchdb", "index_dir") of
+ undefined -> config:get("couchdb", "view_index_dir");
Value -> Value
end.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_mrview/src/couch_mrview_compactor.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview/src/couch_mrview_compactor.erl b/src/couch_mrview/src/couch_mrview_compactor.erl
index 10fdfdc..b45d92b 100644
--- a/src/couch_mrview/src/couch_mrview_compactor.erl
+++ b/src/couch_mrview/src/couch_mrview_compactor.erl
@@ -68,7 +68,7 @@ compact(State) ->
{progress, 0}
]),
- BufferSize0 = couch_config:get(
+ BufferSize0 = config:get(
"view_compaction", "keyvalue_buffer_size", "2097152"
),
BufferSize = list_to_integer(BufferSize0),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_mrview/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview/src/couch_mrview_updater.erl b/src/couch_mrview/src/couch_mrview_updater.erl
index 17b0432..99aedd0 100644
--- a/src/couch_mrview/src/couch_mrview_updater.erl
+++ b/src/couch_mrview/src/couch_mrview_updater.erl
@@ -213,8 +213,8 @@ accumulate_writes(State, W, Acc0) ->
accumulate_more(NumDocIds) ->
% check if we have enough items now
- MinItems = couch_config:get("view_updater", "min_writer_items", "100"),
- MinSize = couch_config:get("view_updater", "min_writer_size", "16777216"),
+ MinItems = config:get("view_updater", "min_writer_items", "100"),
+ MinSize = config:get("view_updater", "min_writer_size", "16777216"),
{memory, CurrMem} = process_info(self(), memory),
NumDocIds < list_to_integer(MinItems)
andalso CurrMem < list_to_integer(MinSize).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_replicator/test/02-httpc-pool.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/02-httpc-pool.t b/src/couch_replicator/test/02-httpc-pool.t
index a7bde6c..23d7ab7 100755
--- a/src/couch_replicator/test/02-httpc-pool.t
+++ b/src/couch_replicator/test/02-httpc-pool.t
@@ -239,8 +239,8 @@ loop(Parent, Ref, Worker, Pool) ->
spawn_pool() ->
- Host = couch_config:get("httpd", "bind_address", "127.0.0.1"),
- Port = couch_config:get("httpd", "port", "5984"),
+ Host = config:get("httpd", "bind_address", "127.0.0.1"),
+ Port = config:get("httpd", "port", "5984"),
{ok, Pool} = couch_replicator_httpc_pool:start_link(
"http://" ++ Host ++ ":5984", [{max_connections, 3}]),
Pool.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_replicator/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/03-replication-compact.t b/src/couch_replicator/test/03-replication-compact.t
index 8d42d46..619d2b4 100755
--- a/src/couch_replicator/test/03-replication-compact.t
+++ b/src/couch_replicator/test/03-replication-compact.t
@@ -444,7 +444,7 @@ maybe_pause(Parent, Counter) ->
db_url(DbName) ->
iolist_to_binary([
- "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
+ "http://", config:get("httpd", "bind_address", "127.0.0.1"),
":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
"/", DbName
]).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_replicator/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/04-replication-large-atts.t b/src/couch_replicator/test/04-replication-large-atts.t
index 5386179..caf2f67 100755
--- a/src/couch_replicator/test/04-replication-large-atts.t
+++ b/src/couch_replicator/test/04-replication-large-atts.t
@@ -66,7 +66,7 @@ test() ->
couch_server_sup:start_link(test_util:config_files()),
ibrowse:start(),
crypto:start(),
- couch_config:set("attachments", "compressible_types", "text/*", false),
+ config:set("attachments", "compressible_types", "text/*", false),
Pairs = [
{source_db_name(), target_db_name()},
@@ -227,7 +227,7 @@ att_decoded_md5(Att) ->
db_url(DbName) ->
iolist_to_binary([
- "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
+ "http://", config:get("httpd", "bind_address", "127.0.0.1"),
":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
"/", DbName
]).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_replicator/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/05-replication-many-leaves.t b/src/couch_replicator/test/05-replication-many-leaves.t
index 212ee99..be63d41 100755
--- a/src/couch_replicator/test/05-replication-many-leaves.t
+++ b/src/couch_replicator/test/05-replication-many-leaves.t
@@ -78,7 +78,7 @@ test() ->
couch_server_sup:start_link(test_util:config_files()),
ibrowse:start(),
crypto:start(),
- couch_config:set("replicator", "connection_timeout", "90000", false),
+ config:set("replicator", "connection_timeout", "90000", false),
Pairs = [
{source_db_name(), target_db_name()},
@@ -254,7 +254,7 @@ add_attachments(SourceDb, [{DocId, RevList} | Rest], NumAtts, IdRevsAcc) ->
db_url(DbName) ->
iolist_to_binary([
- "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
+ "http://", config:get("httpd", "bind_address", "127.0.0.1"),
":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
"/", DbName
]).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/src/couch_replicator/test/06-doc-missing-stubs.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/06-doc-missing-stubs.t b/src/couch_replicator/test/06-doc-missing-stubs.t
index e17efc9..0fffec2 100755
--- a/src/couch_replicator/test/06-doc-missing-stubs.t
+++ b/src/couch_replicator/test/06-doc-missing-stubs.t
@@ -264,7 +264,7 @@ att_decoded_md5(Att) ->
db_url(DbName) ->
iolist_to_binary([
- "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
+ "http://", config:get("httpd", "bind_address", "127.0.0.1"),
":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
"/", DbName
]).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/001-load.t
----------------------------------------------------------------------
diff --git a/test/etap/001-load.t b/test/etap/001-load.t
index c9c2922..a5fa27f 100755
--- a/test/etap/001-load.t
+++ b/test/etap/001-load.t
@@ -22,8 +22,6 @@ main(_) ->
couch_btree,
couch_changes,
couch_compress,
- couch_config,
- couch_config_writer,
couch_db,
couch_db_update_notifier,
couch_db_update_notifier_sup,
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/002-icu-driver.t
----------------------------------------------------------------------
diff --git a/test/etap/002-icu-driver.t b/test/etap/002-icu-driver.t
index e233533..2ce47d9 100755
--- a/test/etap/002-icu-driver.t
+++ b/test/etap/002-icu-driver.t
@@ -13,7 +13,7 @@
main(_) ->
test_util:init_code_path(),
- couch_config:start_link(test_util:config_files()),
+ application:start(config),
etap:plan(3),
etap:is(
element(1, couch_drv:start_link()),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/030-doc-from-json.t
----------------------------------------------------------------------
diff --git a/test/etap/030-doc-from-json.t b/test/etap/030-doc-from-json.t
index b0c393e..79d5692 100755
--- a/test/etap/030-doc-from-json.t
+++ b/test/etap/030-doc-from-json.t
@@ -33,8 +33,8 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(test_util:config_files()),
- couch_config:set("attachments", "compression_level", "0", false),
+ application:start(config),
+ config:set("attachments", "compression_level", "0", false),
ok = test_from_json_success(),
ok = test_from_json_errors(),
ok.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/031-doc-to-json.t
----------------------------------------------------------------------
diff --git a/test/etap/031-doc-to-json.t b/test/etap/031-doc-to-json.t
index ce950f9..e0aaf70 100755
--- a/test/etap/031-doc-to-json.t
+++ b/test/etap/031-doc-to-json.t
@@ -33,8 +33,8 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(test_util:config_files()),
- couch_config:set("attachments", "compression_level", "0", false),
+ application:start(config),
+ config:set("attachments", "compression_level", "0", false),
ok = test_to_json_success(),
ok.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/041-uuid-gen-id.ini
----------------------------------------------------------------------
diff --git a/test/etap/041-uuid-gen-id.ini b/test/etap/041-uuid-gen-id.ini
deleted file mode 100644
index 6886efd..0000000
--- a/test/etap/041-uuid-gen-id.ini
+++ /dev/null
@@ -1,20 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one
-; or more contributor license agreements. See the NOTICE file
-; distributed with this work for additional information
-; regarding copyright ownership. The ASF licenses this file
-; to you under the Apache License, Version 2.0 (the
-; "License"); you may not use this file except in compliance
-; with the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing,
-; software distributed under the License is distributed on an
-; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-; KIND, either express or implied. See the License for the
-; specific language governing permissions and limitations
-; under the License.
-
-[uuids]
-algorithm = utc_id
-utc_id_suffix = bozo
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/041-uuid-gen-seq.ini
----------------------------------------------------------------------
diff --git a/test/etap/041-uuid-gen-seq.ini b/test/etap/041-uuid-gen-seq.ini
deleted file mode 100644
index 94cebc6..0000000
--- a/test/etap/041-uuid-gen-seq.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one
-; or more contributor license agreements. See the NOTICE file
-; distributed with this work for additional information
-; regarding copyright ownership. The ASF licenses this file
-; to you under the Apache License, Version 2.0 (the
-; "License"); you may not use this file except in compliance
-; with the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing,
-; software distributed under the License is distributed on an
-; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-; KIND, either express or implied. See the License for the
-; specific language governing permissions and limitations
-; under the License.
-
-[uuids]
-algorithm = sequential
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/041-uuid-gen-utc.ini
----------------------------------------------------------------------
diff --git a/test/etap/041-uuid-gen-utc.ini b/test/etap/041-uuid-gen-utc.ini
deleted file mode 100644
index c2b8383..0000000
--- a/test/etap/041-uuid-gen-utc.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one
-; or more contributor license agreements. See the NOTICE file
-; distributed with this work for additional information
-; regarding copyright ownership. The ASF licenses this file
-; to you under the Apache License, Version 2.0 (the
-; "License"); you may not use this file except in compliance
-; with the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing,
-; software distributed under the License is distributed on an
-; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-; KIND, either express or implied. See the License for the
-; specific language governing permissions and limitations
-; under the License.
-
-[uuids]
-algorithm = utc_random
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/041-uuid-gen.t
----------------------------------------------------------------------
diff --git a/test/etap/041-uuid-gen.t b/test/etap/041-uuid-gen.t
index 7234969..da1ded1 100755
--- a/test/etap/041-uuid-gen.t
+++ b/test/etap/041-uuid-gen.t
@@ -13,36 +13,19 @@
% License for the specific language governing permissions and limitations under
% the License.
-default_config() ->
- test_util:build_file("etc/couchdb/default_dev.ini").
-
-seq_alg_config() ->
- test_util:source_file("test/etap/041-uuid-gen-seq.ini").
-
-utc_alg_config() ->
- test_util:source_file("test/etap/041-uuid-gen-utc.ini").
-
-utc_id_alg_config() ->
- test_util:source_file("test/etap/041-uuid-gen-id.ini").
-
% Run tests and wait for the gen_servers to shutdown
-run_test(IniFiles, Test) ->
- {ok, Pid} = couch_config:start_link(IniFiles),
- erlang:monitor(process, Pid),
+run_test(Config, Test) ->
+ lists:foreach(fun({Key, Value}) ->
+ config:set("uuids", Key, Value, false)
+ end, Config),
couch_uuids:start(),
Test(),
- couch_uuids:stop(),
- couch_config:stop(),
- receive
- {'DOWN', _, _, Pid, _} -> ok;
- _Other -> etap:diag("OTHER: ~p~n", [_Other])
- after
- 1000 -> throw({timeout_error, config_stop})
- end.
+ couch_uuids:stop().
main(_) ->
test_util:init_code_path(),
application:start(crypto),
+ application:start(config),
etap:plan(9),
case (catch test()) of
@@ -55,7 +38,6 @@ main(_) ->
ok.
test() ->
-
TestUnique = fun() ->
etap:is(
test_unique(10000, couch_uuids:new()),
@@ -63,10 +45,10 @@ test() ->
"Can generate 10K unique IDs"
)
end,
- run_test([default_config()], TestUnique),
- run_test([default_config(), seq_alg_config()], TestUnique),
- run_test([default_config(), utc_alg_config()], TestUnique),
- run_test([default_config(), utc_id_alg_config()], TestUnique),
+ run_test([{"algorithm", "random"}], TestUnique),
+ run_test([{"algorithm", "sequential"}], TestUnique),
+ run_test([{"algorithm", "utc_random"}], TestUnique),
+ run_test([{"algorithm", "utc_id"}, {"utc_id_suffix", "bozo"}], TestUnique),
TestMonotonic = fun () ->
etap:is(
@@ -75,9 +57,10 @@ test() ->
"should produce monotonically increasing ids"
)
end,
- run_test([default_config(), seq_alg_config()], TestMonotonic),
- run_test([default_config(), utc_alg_config()], TestMonotonic),
- run_test([default_config(), utc_id_alg_config()], TestMonotonic),
+ run_test([{"algorithm", "sequential"}], TestMonotonic),
+ run_test([{"algorithm", "utc_random"}], TestMonotonic),
+ run_test([{"algorithm", "utc_id"}, {"utc_id_suffix", "bozo"}],
+ TestMonotonic),
% Pretty sure that the average of a uniform distribution is the
% midpoint of the range. Thus, to exceed a threshold, we need
@@ -99,7 +82,7 @@ test() ->
"should roll over every so often."
)
end,
- run_test([default_config(), seq_alg_config()], TestRollOver),
+ run_test([{"algorithm", "sequential"}], TestRollOver),
TestSuffix = fun() ->
UUID = binary_to_list(couch_uuids:new()),
@@ -110,7 +93,7 @@ test() ->
"utc_id ids should have the same suffix."
)
end,
- run_test([default_config(), utc_id_alg_config()], TestSuffix).
+ run_test([{"algorithm", "utc_id"}, {"utc_id_suffix", "bozo"}], TestSuffix).
test_unique(0, _) ->
true;
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/072-cleanup.t
----------------------------------------------------------------------
diff --git a/test/etap/072-cleanup.t b/test/etap/072-cleanup.t
index 6721090..83b8a6b 100755
--- a/test/etap/072-cleanup.t
+++ b/test/etap/072-cleanup.t
@@ -103,7 +103,7 @@ delete_design_doc(DDName, Rev) ->
couch_db:close(Db).
db_url() ->
- Addr = couch_config:get("httpd", "bind_address", "127.0.0.1"),
+ Addr = config:get("httpd", "bind_address", "127.0.0.1"),
Port = integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
"http://" ++ Addr ++ ":" ++ Port ++ "/" ++
binary_to_list(?TEST_DB).
@@ -121,6 +121,6 @@ view_cleanup() ->
count_index_files() ->
% call server to fetch the index files
- RootDir = couch_config:get("couchdb", "index_dir"),
+ RootDir = config:get("couchdb", "index_dir"),
length(filelib:wildcard(RootDir ++ "/." ++
binary_to_list(?TEST_DB) ++ "_design"++"/mrview/*")).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/074-doc-update-conflicts.t
----------------------------------------------------------------------
diff --git a/test/etap/074-doc-update-conflicts.t b/test/etap/074-doc-update-conflicts.t
index 09d0633..185a419 100755
--- a/test/etap/074-doc-update-conflicts.t
+++ b/test/etap/074-doc-update-conflicts.t
@@ -39,7 +39,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- couch_config:set("couchdb", "delayed_commits", "true", false),
+ config:set("couchdb", "delayed_commits", "true", false),
lists:foreach(
fun(NumClients) -> test_concurrent_doc_update(NumClients) end,
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/075-auth-cache.t
----------------------------------------------------------------------
diff --git a/test/etap/075-auth-cache.t b/test/etap/075-auth-cache.t
index 4af7aba..1b88858 100755
--- a/test/etap/075-auth-cache.t
+++ b/test/etap/075-auth-cache.t
@@ -66,14 +66,14 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- OrigName = couch_config:get("couch_httpd_auth", "authentication_db"),
- couch_config:set(
+ OrigName = config:get("couch_httpd_auth", "authentication_db"),
+ config:set(
"couch_httpd_auth", "authentication_db",
binary_to_list(auth_db_name()), false),
test_auth_db_crash(),
- couch_config:set("couch_httpd_auth", "authentication_db", OrigName, false),
+ config:set("couch_httpd_auth", "authentication_db", OrigName, false),
delete_db(auth_db_name()),
delete_db(auth_db_2_name()),
couch_server_sup:stop(),
@@ -136,7 +136,7 @@ test_auth_db_crash() ->
full_commit(auth_db_name()),
etap:diag("Changing the auth database"),
- couch_config:set(
+ config:set(
"couch_httpd_auth", "authentication_db",
binary_to_list(auth_db_2_name()), false),
ok = timer:sleep(500),
@@ -171,7 +171,7 @@ test_auth_db_crash() ->
"Cached credentials have the new password"),
etap:diag("Changing the auth database again"),
- couch_config:set(
+ config:set(
"couch_httpd_auth", "authentication_db",
binary_to_list(auth_db_name()), false),
ok = timer:sleep(500),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/076-file-compression.t
----------------------------------------------------------------------
diff --git a/test/etap/076-file-compression.t b/test/etap/076-file-compression.t
index 8afa599..5f75ad6 100755
--- a/test/etap/076-file-compression.t
+++ b/test/etap/076-file-compression.t
@@ -39,7 +39,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- couch_config:set("couchdb", "file_compression", "none", false),
+ config:set("couchdb", "file_compression", "none", false),
create_database(),
compact_db(),
@@ -47,7 +47,7 @@ test() ->
DbDiskSize1 = db_disk_size(),
ViewDiskSize1 = view_disk_size(),
- couch_config:set("couchdb", "file_compression", "snappy", false),
+ config:set("couchdb", "file_compression", "snappy", false),
compact_db(),
compact_view(),
DbDiskSize2 = db_disk_size(),
@@ -56,7 +56,7 @@ test() ->
etap:is(DbDiskSize2 < DbDiskSize1, true, "Database disk size decreased"),
etap:is(ViewDiskSize2 < ViewDiskSize1, true, "Index disk size decreased"),
- couch_config:set("couchdb", "file_compression", "deflate_9", false),
+ config:set("couchdb", "file_compression", "deflate_9", false),
compact_db(),
compact_view(),
DbDiskSize3 = db_disk_size(),
@@ -65,7 +65,7 @@ test() ->
etap:is(DbDiskSize3 < DbDiskSize2, true, "Database disk size decreased again"),
etap:is(ViewDiskSize3 < ViewDiskSize2, true, "Index disk size decreased again"),
- couch_config:set("couchdb", "file_compression", "deflate_1", false),
+ config:set("couchdb", "file_compression", "deflate_1", false),
compact_db(),
compact_view(),
DbDiskSize4 = db_disk_size(),
@@ -74,7 +74,7 @@ test() ->
etap:is(DbDiskSize4 > DbDiskSize3, true, "Database disk size increased"),
etap:is(ViewDiskSize4 > ViewDiskSize3, true, "Index disk size increased"),
- couch_config:set("couchdb", "file_compression", "snappy", false),
+ config:set("couchdb", "file_compression", "snappy", false),
compact_db(),
compact_view(),
DbDiskSize5 = db_disk_size(),
@@ -83,7 +83,7 @@ test() ->
etap:is(DbDiskSize5 > DbDiskSize4, true, "Database disk size increased again"),
etap:is(ViewDiskSize5 > ViewDiskSize4, true, "Index disk size increased again"),
- couch_config:set("couchdb", "file_compression", "none", false),
+ config:set("couchdb", "file_compression", "none", false),
compact_db(),
compact_view(),
DbDiskSize6 = db_disk_size(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/080-config-get-set.t
----------------------------------------------------------------------
diff --git a/test/etap/080-config-get-set.t b/test/etap/080-config-get-set.t
index 94a9cba..6e5395e 100755
--- a/test/etap/080-config-get-set.t
+++ b/test/etap/080-config-get-set.t
@@ -29,8 +29,7 @@ main(_) ->
ok.
test() ->
- % start couch_config with default
- couch_config:start_link([default_config()]),
+ application:start(config),
% Check that we can get values
@@ -38,36 +37,36 @@ test() ->
etap:fun_is(
fun(List) -> length(List) > 0 end,
- couch_config:all(),
+ config:all(),
"Data was loaded from the INI file."
),
etap:fun_is(
fun(List) -> length(List) > 0 end,
- couch_config:get("daemons"),
+ config:get("daemons"),
"There are settings in the [daemons] section of the INI file."
),
etap:is(
- couch_config:get("httpd_design_handlers", "_view"),
+ config:get("httpd_design_handlers", "_view"),
"{couch_mrview_http, handle_view_req}",
"The {httpd_design_handlers, view} is the expected default."
),
etap:is(
- couch_config:get("httpd", "foo", "bar"),
+ config:get("httpd", "foo", "bar"),
"bar",
"Returns the default when key doesn't exist in config."
),
etap:is(
- couch_config:get("httpd", "foo"),
+ config:get("httpd", "foo"),
undefined,
"The default default is the atom 'undefined'."
),
etap:is(
- couch_config:get("httpd", "port", "bar"),
+ config:get("httpd", "port", "bar"),
"5984",
"Only returns the default when the config setting does not exist."
),
@@ -76,24 +75,24 @@ test() ->
% Check that setting values works.
- ok = couch_config:set("log", "level", "severe", false),
+ ok = config:set("log", "level", "severe", false),
etap:is(
- couch_config:get("log", "level"),
+ config:get("log", "level"),
"severe",
"Non persisted changes take effect."
),
etap:is(
- couch_config:get("new_section", "bizzle"),
+ config:get("new_section", "bizzle"),
undefined,
"Section 'new_section' does not exist."
),
- ok = couch_config:set("new_section", "bizzle", "bang", false),
+ ok = config:set("new_section", "bizzle", "bang", false),
etap:is(
- couch_config:get("new_section", "bizzle"),
+ config:get("new_section", "bizzle"),
"bang",
"New section 'new_section' was created for a new key/value pair."
),
@@ -102,9 +101,9 @@ test() ->
% Check that deleting works
- ok = couch_config:delete("new_section", "bizzle", false),
+ ok = config:delete("new_section", "bizzle", false),
etap:is(
- couch_config:get("new_section", "bizzle"),
+ config:get("new_section", "bizzle"),
undefined,
"Deleting sets the value to \"\""
),
@@ -112,15 +111,15 @@ test() ->
% Check ge/set/delete binary strings
- ok = couch_config:set(<<"foo">>, <<"bar">>, <<"baz">>, false),
+ ok = config:set(<<"foo">>, <<"bar">>, <<"baz">>, false),
etap:is(
- couch_config:get(<<"foo">>, <<"bar">>),
+ config:get(<<"foo">>, <<"bar">>),
<<"baz">>,
"Can get and set with binary section and key values."
),
- ok = couch_config:delete(<<"foo">>, <<"bar">>, false),
+ ok = config:delete(<<"foo">>, <<"bar">>, false),
etap:is(
- couch_config:get(<<"foo">>, <<"bar">>),
+ config:get(<<"foo">>, <<"bar">>),
undefined,
"Deleting with binary section/key pairs sets the value to \"\""
),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/081-config-override.t
----------------------------------------------------------------------
diff --git a/test/etap/081-config-override.t b/test/etap/081-config-override.t
index 01f8b4c..2d47122 100755
--- a/test/etap/081-config-override.t
+++ b/test/etap/081-config-override.t
@@ -27,10 +27,10 @@ local_config_write() ->
% Run tests and wait for the config gen_server to shutdown.
run_tests(IniFiles, Tests) ->
- {ok, Pid} = couch_config:start_link(IniFiles),
+ application:start(config),
erlang:monitor(process, Pid),
Tests(),
- couch_config:stop(),
+ config:stop(),
receive
{'DOWN', _, _, Pid, _} -> ok;
_Other -> etap:diag("OTHER: ~p~n", [_Other])
@@ -58,19 +58,19 @@ test() ->
CheckDefaults = fun() ->
etap:is(
- couch_config:get("couchdb", "max_dbs_open"),
+ config:get("couchdb", "max_dbs_open"),
"100",
"{couchdb, max_dbs_open} is 100 by defualt."
),
etap:is(
- couch_config:get("httpd","port"),
+ config:get("httpd","port"),
"5984",
"{httpd, port} is 5984 by default"
),
etap:is(
- couch_config:get("fizbang", "unicode"),
+ config:get("fizbang", "unicode"),
undefined,
"{fizbang, unicode} is undefined by default"
)
@@ -83,13 +83,13 @@ test() ->
CheckOverride = fun() ->
etap:is(
- couch_config:get("couchdb", "max_dbs_open"),
+ config:get("couchdb", "max_dbs_open"),
"10",
"{couchdb, max_dbs_open} was overriden with the value 10"
),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"4895",
"{httpd, port} was overriden with the value 4895"
)
@@ -102,13 +102,13 @@ test() ->
CheckOverride2 = fun() ->
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"80",
"{httpd, port} is overriden with the value 80"
),
etap:is(
- couch_config:get("fizbang", "unicode"),
+ config:get("fizbang", "unicode"),
"normalized",
"{fizbang, unicode} was created by override INI file"
)
@@ -121,7 +121,7 @@ test() ->
CheckOverride3 = fun() ->
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"80",
"{httpd, port} value was taken from the last specified INI file."
)
@@ -142,31 +142,31 @@ test() ->
% Open and write a value
CheckCanWrite = fun() ->
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"5984",
"{httpd, port} is still 5984 by default"
),
etap:is(
- couch_config:set("httpd", "port", "8080"),
+ config:set("httpd", "port", "8080"),
ok,
"Writing {httpd, port} is kosher."
),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"8080",
"{httpd, port} was updated to 8080 successfully."
),
etap:is(
- couch_config:delete("httpd", "bind_address"),
+ config:delete("httpd", "bind_address"),
ok,
"Deleting {httpd, bind_address} succeeds"
),
etap:is(
- couch_config:get("httpd", "bind_address"),
+ config:get("httpd", "bind_address"),
undefined,
"{httpd, bind_address} was actually deleted."
)
@@ -178,13 +178,13 @@ test() ->
CheckDidntWrite = fun() ->
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"5984",
"{httpd, port} was not persisted to the primary INI file."
),
etap:is(
- couch_config:get("httpd", "bind_address"),
+ config:get("httpd", "bind_address"),
"127.0.0.1",
"{httpd, bind_address} was not deleted form the primary INI file."
)
@@ -195,13 +195,13 @@ test() ->
% Open and check we have only the persistence we expect.
CheckDidWrite = fun() ->
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"8080",
"{httpd, port} is still 8080 after reopening the config."
),
etap:is(
- couch_config:get("httpd", "bind_address"),
+ config:get("httpd", "bind_address"),
undefined,
"{httpd, bind_address} is still \"\" after reopening."
)
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/082-config-register.t
----------------------------------------------------------------------
diff --git a/test/etap/082-config-register.t b/test/etap/082-config-register.t
index 191ba8f..9487887 100755
--- a/test/etap/082-config-register.t
+++ b/test/etap/082-config-register.t
@@ -29,18 +29,18 @@ main(_) ->
ok.
test() ->
- couch_config:start_link([default_config()]),
+ application:start(config),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"5984",
"{httpd, port} is 5984 by default."
),
- ok = couch_config:set("httpd", "port", "4895", false),
+ ok = config:set("httpd", "port", "4895", false),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"4895",
"{httpd, port} changed to 4895"
),
@@ -52,22 +52,22 @@ test() ->
end,
SentinelPid = spawn(SentinelFunc),
- couch_config:register(
+ config:register(
fun("httpd", "port", Value) ->
etap:is(Value, "8080", "Registered function got notification.")
end,
SentinelPid
),
- ok = couch_config:set("httpd", "port", "8080", false),
+ ok = config:set("httpd", "port", "8080", false),
% Implicitly checking that we *don't* call the function
etap:is(
- couch_config:get("httpd", "bind_address"),
+ config:get("httpd", "bind_address"),
"127.0.0.1",
"{httpd, bind_address} is not '0.0.0.0'"
),
- ok = couch_config:set("httpd", "bind_address", "0.0.0.0", false),
+ ok = config:set("httpd", "bind_address", "0.0.0.0", false),
% Ping-Pong kill process
SentinelPid ! {ping, self()},
@@ -77,18 +77,18 @@ test() ->
throw({timeout_error, registered_pid})
end,
- ok = couch_config:set("httpd", "port", "80", false),
+ ok = config:set("httpd", "port", "80", false),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"80",
"Implicitly test that the function got de-registered"
),
% test passing of Persist flag
- couch_config:register(
+ config:register(
fun("httpd", _, _, Persist) ->
etap:is(Persist, false)
end),
- ok = couch_config:set("httpd", "port", "80", false),
+ ok = config:set("httpd", "port", "80", false),
ok.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/083-config-no-files.t
----------------------------------------------------------------------
diff --git a/test/etap/083-config-no-files.t b/test/etap/083-config-no-files.t
index 0ce38e6..3ad0905 100755
--- a/test/etap/083-config-no-files.t
+++ b/test/etap/083-config-no-files.t
@@ -27,25 +27,25 @@ main(_) ->
ok.
test() ->
- couch_config:start_link([]),
+ application:start(config),
etap:fun_is(
fun(KVPairs) -> length(KVPairs) == 0 end,
- couch_config:all(),
+ config:all(),
"No INI files specified returns 0 key/value pairs."
),
- ok = couch_config:set("httpd", "port", "80", false),
+ ok = config:set("httpd", "port", "80", false),
etap:is(
- couch_config:get("httpd", "port"),
+ config:get("httpd", "port"),
"80",
"Created a new non-persisted k/v pair."
),
- ok = couch_config:set("httpd", "bind_address", "127.0.0.1"),
+ ok = config:set("httpd", "bind_address", "127.0.0.1"),
etap:is(
- couch_config:get("httpd", "bind_address"),
+ config:get("httpd", "bind_address"),
"127.0.0.1",
"Asking for a persistent key/value pair doesn't choke."
),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/121-stats-aggregates.t
----------------------------------------------------------------------
diff --git a/test/etap/121-stats-aggregates.t b/test/etap/121-stats-aggregates.t
index d678aa9..92bf547 100755
--- a/test/etap/121-stats-aggregates.t
+++ b/test/etap/121-stats-aggregates.t
@@ -32,7 +32,7 @@ main(_) ->
ok.
test() ->
- couch_config:start_link([ini_file()]),
+ application:start(config),
couch_stats_collector:start(),
couch_stats_aggregator:start(cfg_file()),
ok = test_all_empty(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/130-attachments-md5.t
----------------------------------------------------------------------
diff --git a/test/etap/130-attachments-md5.t b/test/etap/130-attachments-md5.t
index a91c9bf..12b1aba 100755
--- a/test/etap/130-attachments-md5.t
+++ b/test/etap/130-attachments-md5.t
@@ -39,7 +39,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- Addr = couch_config:get("httpd", "bind_address", any),
+ Addr = config:get("httpd", "bind_address", any),
put(addr, Addr),
put(port, mochiweb_socket_server:get(couch_httpd, port)),
timer:sleep(1000),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/140-attachment-comp.t
----------------------------------------------------------------------
diff --git a/test/etap/140-attachment-comp.t b/test/etap/140-attachment-comp.t
index 2b082c2..6e8640d 100755
--- a/test/etap/140-attachment-comp.t
+++ b/test/etap/140-attachment-comp.t
@@ -31,14 +31,14 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- put(addr, couch_config:get("httpd", "bind_address", "127.0.0.1")),
+ put(addr, config:get("httpd", "bind_address", "127.0.0.1")),
put(port, integer_to_list(mochiweb_socket_server:get(couch_httpd, port))),
timer:sleep(1000),
couch_server:delete(test_db_name(), []),
couch_db:create(test_db_name(), []),
- couch_config:set("attachments", "compression_level", "8", false),
- couch_config:set("attachments", "compressible_types", "text/*", false),
+ config:set("attachments", "compression_level", "8", false),
+ config:set("attachments", "compressible_types", "text/*", false),
create_1st_text_att(),
create_1st_png_att(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/150-invalid-view-seq.t
----------------------------------------------------------------------
diff --git a/test/etap/150-invalid-view-seq.t b/test/etap/150-invalid-view-seq.t
index 681875a..4553b16 100755
--- a/test/etap/150-invalid-view-seq.t
+++ b/test/etap/150-invalid-view-seq.t
@@ -50,7 +50,7 @@ test() ->
% make DB file backup
backup_db_file(),
- put(addr, couch_config:get("httpd", "bind_address", "127.0.0.1")),
+ put(addr, config:get("httpd", "bind_address", "127.0.0.1")),
put(port, integer_to_list(mochiweb_socket_server:get(couch_httpd, port))),
create_new_doc(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/160-vhosts.t
----------------------------------------------------------------------
diff --git a/test/etap/160-vhosts.t b/test/etap/160-vhosts.t
index 46fdd73..4118b94 100755
--- a/test/etap/160-vhosts.t
+++ b/test/etap/160-vhosts.t
@@ -78,22 +78,22 @@ test() ->
%% end boilerplate, start test
- ok = couch_config:set("vhosts", "example.com", "/etap-test-db", false),
- ok = couch_config:set("vhosts", "*.example.com",
+ ok = config:set("vhosts", "example.com", "/etap-test-db", false),
+ ok = config:set("vhosts", "*.example.com",
"/etap-test-db/_design/doc1/_rewrite", false),
- ok = couch_config:set("vhosts", "example.com/test", "/etap-test-db", false),
- ok = couch_config:set("vhosts", "example1.com",
+ ok = config:set("vhosts", "example.com/test", "/etap-test-db", false),
+ ok = config:set("vhosts", "example1.com",
"/etap-test-db/_design/doc1/_rewrite/", false),
- ok = couch_config:set("vhosts",":appname.:dbname.example1.com",
+ ok = config:set("vhosts",":appname.:dbname.example1.com",
"/:dbname/_design/:appname/_rewrite/", false),
- ok = couch_config:set("vhosts", ":dbname.example1.com", "/:dbname", false),
+ ok = config:set("vhosts", ":dbname.example1.com", "/:dbname", false),
- ok = couch_config:set("vhosts", "*.example2.com", "/*", false),
- ok = couch_config:set("vhosts", "*.example2.com/test", "/*", false),
- ok = couch_config:set("vhosts", "*/test", "/etap-test-db", false),
- ok = couch_config:set("vhosts", "*/test1",
+ ok = config:set("vhosts", "*.example2.com", "/*", false),
+ ok = config:set("vhosts", "*.example2.com/test", "/*", false),
+ ok = config:set("vhosts", "*/test", "/etap-test-db", false),
+ ok = config:set("vhosts", "*/test1",
"/etap-test-db/_design/doc1/_show/test", false),
- ok = couch_config:set("vhosts", "example3.com", "/", false),
+ ok = config:set("vhosts", "example3.com", "/", false),
%% reload rules
couch_httpd_vhost:reload(),
@@ -288,12 +288,12 @@ test_vhost_request_to_root() ->
test_vhost_request_with_oauth(Db) ->
{ok, AuthDb} = couch_db:create(
<<"tap_test_sec_db">>, [admin_user_ctx(), overwrite]),
- PrevAuthDbName = couch_config:get("couch_httpd_auth", "authentication_db"),
- couch_config:set("couch_httpd_auth", "authentication_db", "tap_test_sec_db", false),
- couch_config:set("oauth_token_users", "otoksec1", "joe", false),
- couch_config:set("oauth_consumer_secrets", "consec1", "foo", false),
- couch_config:set("oauth_token_secrets", "otoksec1", "foobar", false),
- couch_config:set("couch_httpd_auth", "require_valid_user", "true", false),
+ PrevAuthDbName = config:get("couch_httpd_auth", "authentication_db"),
+ config:set("couch_httpd_auth", "authentication_db", "tap_test_sec_db", false),
+ config:set("oauth_token_users", "otoksec1", "joe", false),
+ config:set("oauth_consumer_secrets", "consec1", "foo", false),
+ config:set("oauth_token_secrets", "otoksec1", "foobar", false),
+ config:set("couch_httpd_auth", "require_valid_user", "true", false),
DDoc = couch_doc:from_json_obj({[
{<<"_id">>, <<"_design/test">>},
@@ -308,7 +308,7 @@ test_vhost_request_with_oauth(Db) ->
{ok, _} = couch_db:update_doc(Db, DDoc, []),
RewritePath = "/etap-test-db/_design/test/_rewrite/foobar",
- ok = couch_config:set("vhosts", "oauth-example.com", RewritePath, false),
+ ok = config:set("vhosts", "oauth-example.com", RewritePath, false),
couch_httpd_vhost:reload(),
case ibrowse:send_req(server(), [], get, [], [{host_header, "oauth-example.com"}]) of
@@ -366,6 +366,6 @@ test_vhost_request_with_oauth(Db) ->
couch_util:to_list(Error3))
end,
- couch_config:set("couch_httpd_auth", "authentication_db", PrevAuthDbName, false),
- couch_config:set("couch_httpd_auth", "require_valid_user", "false", false),
+ config:set("couch_httpd_auth", "authentication_db", PrevAuthDbName, false),
+ config:set("couch_httpd_auth", "require_valid_user", "false", false),
ok = couch_server:delete(couch_db:name(AuthDb), [admin_user_ctx()]).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/170-os-daemons.t
----------------------------------------------------------------------
diff --git a/test/etap/170-os-daemons.t b/test/etap/170-os-daemons.t
index 6feaa1b..f1961a9 100755
--- a/test/etap/170-os-daemons.t
+++ b/test/etap/170-os-daemons.t
@@ -46,11 +46,11 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(config_files()),
+ application:start(config),
couch_os_daemons:start_link(),
etap:diag("Daemons boot after configuration added."),
- couch_config:set("os_daemons", "foo", daemon_cmd(), false),
+ config:set("os_daemons", "foo", daemon_cmd(), false),
timer:sleep(1000),
{ok, [D1]} = couch_os_daemons:info([table]),
@@ -62,7 +62,7 @@ test() ->
check_daemon(T1, "foo"),
etap:diag("Daemons stop after configuration removed."),
- couch_config:delete("os_daemons", "foo", false),
+ config:delete("os_daemons", "foo", false),
timer:sleep(500),
{ok, []} = couch_os_daemons:info([table]),
@@ -70,8 +70,8 @@ test() ->
etap:is(ets:tab2list(Tab2), [], "As table returns empty table."),
etap:diag("Adding multiple daemons causes both to boot."),
- couch_config:set("os_daemons", "bar", daemon_cmd(), false),
- couch_config:set("os_daemons", "baz", daemon_cmd(), false),
+ config:set("os_daemons", "bar", daemon_cmd(), false),
+ config:set("os_daemons", "baz", daemon_cmd(), false),
timer:sleep(500),
{ok, Daemons} = couch_os_daemons:info([table]),
lists:foreach(fun(D) ->
@@ -84,7 +84,7 @@ test() ->
end, ets:tab2list(Tab3)),
etap:diag("Removing one daemon leaves the other alive."),
- couch_config:delete("os_daemons", "bar", false),
+ config:delete("os_daemons", "bar", false),
timer:sleep(500),
{ok, [D2]} = couch_os_daemons:info([table]),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/171-os-daemons-config.es
----------------------------------------------------------------------
diff --git a/test/etap/171-os-daemons-config.es b/test/etap/171-os-daemons-config.es
index b4a914e..15da0e9 100755
--- a/test/etap/171-os-daemons-config.es
+++ b/test/etap/171-os-daemons-config.es
@@ -80,6 +80,6 @@ loop({error, _Reason}) ->
main([]) ->
test_util:init_code_path(),
- couch_config:start_link(test_util:config_files()),
+ application:start(config),
couch_drv:start_link(),
do_tests().
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/171-os-daemons-config.t
----------------------------------------------------------------------
diff --git a/test/etap/171-os-daemons-config.t b/test/etap/171-os-daemons-config.t
index e9dc3f3..8254c26 100755
--- a/test/etap/171-os-daemons-config.t
+++ b/test/etap/171-os-daemons-config.t
@@ -46,13 +46,13 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(config_files()),
- couch_config:set("log", "level", "debug", false),
+ application:start(config),
+ config:set("log", "level", "debug", false),
couch_log:start_link(),
couch_os_daemons:start_link(),
% "foo" is a required name by this test.
- couch_config:set("os_daemons", "foo", daemon_cmd(), false),
+ config:set("os_daemons", "foo", daemon_cmd(), false),
timer:sleep(1000),
{ok, [D1]} = couch_os_daemons:info([table]),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/172-os-daemon-errors.t
----------------------------------------------------------------------
diff --git a/test/etap/172-os-daemon-errors.t b/test/etap/172-os-daemon-errors.t
index bde5c6f..1b1fc30 100755
--- a/test/etap/172-os-daemon-errors.t
+++ b/test/etap/172-os-daemon-errors.t
@@ -55,7 +55,7 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(config_files()),
+ application:start(config),
couch_os_daemons:start_link(),
etap:diag("Daemon not executable."),
@@ -73,14 +73,14 @@ test() ->
ok.
test_halts(Name, Cmd, Time) ->
- couch_config:set("os_daemons", Name, Cmd ++ " 2> /dev/null", false),
+ config:set("os_daemons", Name, Cmd ++ " 2> /dev/null", false),
timer:sleep(Time),
{ok, [D]} = couch_os_daemons:info([table]),
check_dead(D, Name, Cmd),
- couch_config:delete("os_daemons", Name, false).
+ config:delete("os_daemons", Name, false).
test_runs(Name, Cmd) ->
- couch_config:set("os_daemons", Name, Cmd, false),
+ config:set("os_daemons", Name, Cmd, false),
timer:sleep(1000),
{ok, [D1]} = couch_os_daemons:info([table]),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/173-os-daemon-cfg-register.t
----------------------------------------------------------------------
diff --git a/test/etap/173-os-daemon-cfg-register.t b/test/etap/173-os-daemon-cfg-register.t
index 256ee7d..065e999 100755
--- a/test/etap/173-os-daemon-cfg-register.t
+++ b/test/etap/173-os-daemon-cfg-register.t
@@ -44,32 +44,32 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(test_util:config_files()),
+ application:start(config),
couch_os_daemons:start_link(),
DaemonCmd = daemon_cmd() ++ " 2> /dev/null",
etap:diag("Booting the daemon"),
- couch_config:set("os_daemons", daemon_name(), DaemonCmd, false),
+ config:set("os_daemons", daemon_name(), DaemonCmd, false),
wait_for_start(10),
{ok, [D1]} = couch_os_daemons:info([table]),
check_daemon(D1, running),
etap:diag("Daemon restarts when section changes."),
- couch_config:set("s1", "k", "foo", false),
+ config:set("s1", "k", "foo", false),
wait_for_restart(10),
{ok, [D2]} = couch_os_daemons:info([table]),
check_daemon(D2, running),
etap:isnt(D2#daemon.kill, D1#daemon.kill, "Kill command shows restart."),
etap:diag("Daemon doesn't restart for ignored section key."),
- couch_config:set("s2", "k2", "baz", false),
+ config:set("s2", "k2", "baz", false),
timer:sleep(1000), % Message travel time.
{ok, [D3]} = couch_os_daemons:info([table]),
etap:is(D3, D2, "Same daemon info after ignored config change."),
etap:diag("Daemon restarts for specific section/key pairs."),
- couch_config:set("s2", "k", "bingo", false),
+ config:set("s2", "k", "bingo", false),
wait_for_restart(10),
{ok, [D4]} = couch_os_daemons:info([table]),
check_daemon(D4, running),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/180-http-proxy.t
----------------------------------------------------------------------
diff --git a/test/etap/180-http-proxy.t b/test/etap/180-http-proxy.t
index da67603..55f6aab 100755
--- a/test/etap/180-http-proxy.t
+++ b/test/etap/180-http-proxy.t
@@ -79,7 +79,7 @@ test() ->
test_web:get_port(),
"/\">>}"
]),
- couch_config:set("httpd_global_handlers", "_test", Url, false),
+ config:set("httpd_global_handlers", "_test", Url, false),
% let couch_httpd restart
timer:sleep(100),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/200-view-group-no-db-leaks.t
----------------------------------------------------------------------
diff --git a/test/etap/200-view-group-no-db-leaks.t b/test/etap/200-view-group-no-db-leaks.t
index 350cc0b..f6ae3f0 100755
--- a/test/etap/200-view-group-no-db-leaks.t
+++ b/test/etap/200-view-group-no-db-leaks.t
@@ -65,7 +65,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
timer:sleep(1000),
- put(addr, couch_config:get("httpd", "bind_address", "127.0.0.1")),
+ put(addr, config:get("httpd", "bind_address", "127.0.0.1")),
put(port, integer_to_list(mochiweb_socket_server:get(couch_httpd, port))),
delete_db(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/201-view-group-shutdown.t
----------------------------------------------------------------------
diff --git a/test/etap/201-view-group-shutdown.t b/test/etap/201-view-group-shutdown.t
index fabedf2..fa77d89 100755
--- a/test/etap/201-view-group-shutdown.t
+++ b/test/etap/201-view-group-shutdown.t
@@ -65,8 +65,8 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- ok = couch_config:set("couchdb", "max_dbs_open", "3", false),
- ok = couch_config:set("couchdb", "delayed_commits", "false", false),
+ ok = config:set("couchdb", "max_dbs_open", "3", false),
+ ok = config:set("couchdb", "delayed_commits", "false", false),
crypto:start(),
% Test that while a view group is being compacted its database can not
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/210-os-proc-pool.t
----------------------------------------------------------------------
diff --git a/test/etap/210-os-proc-pool.t b/test/etap/210-os-proc-pool.t
index d80707e..85fa9a6 100755
--- a/test/etap/210-os-proc-pool.t
+++ b/test/etap/210-os-proc-pool.t
@@ -28,7 +28,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
- couch_config:set("query_server_config", "os_process_limit", "3", false),
+ config:set("query_server_config", "os_process_limit", "3", false),
test_pool_full(),
test_client_unexpected_exit(),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/220-compaction-daemon.t
----------------------------------------------------------------------
diff --git a/test/etap/220-compaction-daemon.t b/test/etap/220-compaction-daemon.t
index 4c63b66..73bd5ac 100755
--- a/test/etap/220-compaction-daemon.t
+++ b/test/etap/220-compaction-daemon.t
@@ -38,7 +38,7 @@ main(_) ->
test() ->
couch_server_sup:start_link(test_util:config_files()),
timer:sleep(1000),
- put(addr, couch_config:get("httpd", "bind_address", "127.0.0.1")),
+ put(addr, config:get("httpd", "bind_address", "127.0.0.1")),
put(port, integer_to_list(mochiweb_socket_server:get(couch_httpd, port))),
disable_compact_daemon(),
@@ -54,9 +54,9 @@ test() ->
{_, ViewFileSize} = get_view_frag(),
% enable automatic compaction
- ok = couch_config:set("compaction_daemon", "check_interval", "3", false),
- ok = couch_config:set("compaction_daemon", "min_file_size", "100000", false),
- ok = couch_config:set(
+ ok = config:set("compaction_daemon", "check_interval", "3", false),
+ ok = config:set("compaction_daemon", "min_file_size", "100000", false),
+ ok = config:set(
"compactions",
binary_to_list(test_db_name()),
"[{db_fragmentation, \"70%\"}, {view_fragmentation, \"70%\"}]",
@@ -81,7 +81,7 @@ test() ->
{_, ViewFileSize3} = get_view_frag(),
% enable automatic compaction
- ok = couch_config:set(
+ ok = config:set(
"compactions",
"_default",
"[{db_fragmentation, \"70%\"}, {view_fragmentation, \"70%\"}]",
@@ -106,10 +106,10 @@ test() ->
ok.
disable_compact_daemon() ->
- Configs = couch_config:get("compactions"),
+ Configs = config:get("compactions"),
lists:foreach(
fun({DbName, _}) ->
- ok = couch_config:delete("compactions", DbName, false)
+ ok = config:delete("compactions", DbName, false)
end,
Configs).
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0861ab00/test/etap/231-cors.t
----------------------------------------------------------------------
diff --git a/test/etap/231-cors.t b/test/etap/231-cors.t
index ad92ae9..cfc6a94 100644
--- a/test/etap/231-cors.t
+++ b/test/etap/231-cors.t
@@ -50,7 +50,7 @@ admin_user_ctx() -> {user_ctx, #user_ctx{roles=[<<"_admin">>]}}.
set_admin_password(UserName, Password) ->
Hashed = couch_passwords:hash_admin_password(Password),
- couch_config:set("admins", UserName, Hashed, false).
+ config:set("admins", UserName, Hashed, false).
cycle_db(DbName) ->
couch_server:delete(list_to_binary(DbName), [admin_user_ctx()]),
@@ -76,8 +76,8 @@ test() ->
test_no_headers_db(),
% Now enable CORS
- ok = couch_config:set("httpd", "enable_cors", "true", false),
- ok = couch_config:set("cors", "origins", "http://example.com", false),
+ ok = config:set("httpd", "enable_cors", "true", false),
+ ok = config:set("cors", "origins", "http://example.com", false),
%% do tests
test_incorrect_origin_simple_request(),
@@ -91,16 +91,16 @@ test() ->
test_preflight_with_port1(),
test_preflight_with_scheme1(),
- ok = couch_config:set("cors", "origins", "http://example.com:5984", false),
+ ok = config:set("cors", "origins", "http://example.com:5984", false),
test_preflight_with_port2(),
- ok = couch_config:set("cors", "origins", "https://example.com:5984", false),
+ ok = config:set("cors", "origins", "https://example.com:5984", false),
test_preflight_with_scheme2(),
- ok = couch_config:set("cors", "origins", "*", false),
+ ok = config:set("cors", "origins", "*", false),
test_preflight_with_wildcard(),
- ok = couch_config:set("cors", "origins", "http://example.com", false),
+ ok = config:set("cors", "origins", "http://example.com", false),
test_case_sensitive_mismatch_of_allowed_origins(),
% http://www.w3.org/TR/cors/#supports-credentials
@@ -116,14 +116,14 @@ test() ->
% Note: The string "*" cannot be used for a resource
% that supports credentials.
test_db_request_credentials_header_off(),
- ok = couch_config:set("cors", "credentials", "true", false),
+ ok = config:set("cors", "credentials", "true", false),
test_db_request_credentials_header_on(),
% We don’t test wildcards & credentials as that would
% fall into the realm of validating config values
% which we don’t do at all yet
% test with vhosts
- ok = couch_config:set("vhosts", "example.com", "/", false),
+ ok = config:set("vhosts", "example.com", "/", false),
test_preflight_request(true),
test_db_request(true),
test_db_preflight_request(true),