You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/12/12 01:47:04 UTC
(couchdb) 01/03: Clean up config
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 125b3b77b8bc3e3290b2bde2f0320c45ada84196
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Oct 16 13:12:45 2023 -0700
Clean up config
- Remove unused config field, export, include, defines
- Delete confusing test config delete reason
The third argument to `config:delete/3`, if not a boolean, should be a
reason for the deletion. This "8080" that looks like a port number was
presumably a copy-pasta error.
- Ensure these config tests get executed
Unwrap tests from unnecessary `?_test(begin ... end)` so that they
actually execute their assertions.
---
src/config/src/config.erl | 2 --
src/config/test/config_tests.erl | 18 +++++-------------
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/src/config/src/config.erl b/src/config/src/config.erl
index 3ece5326b..b94dc3463 100644
--- a/src/config/src/config.erl
+++ b/src/config/src/config.erl
@@ -34,7 +34,6 @@
-export([listen_for_changes/2]).
-export([subscribe_for_changes/1]).
--export([parse_ini_file/1]).
-export([init/1]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -50,7 +49,6 @@
-define(DELETE, delete).
-record(config, {
- notify_funs = [],
ini_files = undefined,
write_filename = undefined
}).
diff --git a/src/config/test/config_tests.erl b/src/config/test/config_tests.erl
index 90d430a87..dc83d2c72 100644
--- a/src/config/test/config_tests.erl
+++ b/src/config/test/config_tests.erl
@@ -19,7 +19,6 @@
]).
-include_lib("couch/include/couch_eunit.hrl").
--include_lib("couch/include/couch_db.hrl").
-define(TIMEOUT, 4000).
-define(RESTART_TIMEOUT_IN_MILLISEC, 3000).
@@ -56,9 +55,6 @@
FileName
end).
--define(T(F), {erlang:fun_to_list(F), F}).
--define(FEXT(F), fun(_, _) -> F() end).
-
setup() ->
setup(?CONFIG_CHAIN).
@@ -441,7 +437,7 @@ should_write_changes(_, _) ->
?assertEqual("5986", config:get("httpd", "port")),
?assertEqual(ok, config:set("httpd", "port", "8080")),
?assertEqual("8080", config:get("httpd", "port")),
- ?assertEqual(ok, config:delete("httpd", "bind_address", "8080")),
+ ?assertEqual(ok, config:delete("httpd", "bind_address")),
?assertEqual(undefined, config:get("httpd", "bind_address"))
end).
@@ -461,16 +457,12 @@ should_ensure_that_no_ini_files_loaded() ->
?assertEqual(0, length(config:all())).
should_create_non_persistent_option() ->
- ?_test(begin
- ?assertEqual(ok, config:set("httpd", "port", "80", false)),
- ?assertEqual("80", config:get("httpd", "port"))
- end).
+ ?assertEqual(ok, config:set("httpd", "port", "80", false)),
+ ?assertEqual("80", config:get("httpd", "port")).
should_create_persistent_option() ->
- ?_test(begin
- ?assertEqual(ok, config:set("httpd", "bind_address", "127.0.0.1")),
- ?assertEqual("127.0.0.1", config:get("httpd", "bind_address"))
- end).
+ ?assertEqual(ok, config:set("httpd", "bind_address", "127.0.0.1")),
+ ?assertEqual("127.0.0.1", config:get("httpd", "bind_address")).
should_handle_value_change({_Apps, Pid}) ->
?_test(begin