Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B1DF11B4F for ; Fri, 15 Aug 2014 20:24:30 +0000 (UTC) Received: (qmail 73682 invoked by uid 500); 15 Aug 2014 20:24:29 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 73498 invoked by uid 500); 15 Aug 2014 20:24:29 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 73277 invoked by uid 99); 15 Aug 2014 20:24:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Aug 2014 20:24:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0BC319C5AFD; Fri, 15 Aug 2014 20:24:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chewbranca@apache.org To: commits@couchdb.apache.org Date: Fri, 15 Aug 2014 20:24:35 -0000 Message-Id: <818eee58de0547a8bc9b7689066edb43@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/50] [abbrv] couch commit: updated refs/heads/1963-eunit-bigcouch to 95bfc03 Port 083-config-no-files.t etap test suite to eunit Merged into couch_config_tests suite. Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/6f7a3e3f Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/6f7a3e3f Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/6f7a3e3f Branch: refs/heads/1963-eunit-bigcouch Commit: 6f7a3e3f1ca284f5d53ed64e4466987e8a151879 Parents: 5331d80 Author: Alexander Shorin Authored: Mon May 26 09:46:06 2014 +0400 Committer: Russell Branca Committed: Fri Aug 15 13:23:43 2014 -0700 ---------------------------------------------------------------------- test/couchdb/couch_config_tests.erl | 37 +++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/6f7a3e3f/test/couchdb/couch_config_tests.erl ---------------------------------------------------------------------- diff --git a/test/couchdb/couch_config_tests.erl b/test/couchdb/couch_config_tests.erl index fdd2479..9e9dfe7 100644 --- a/test/couchdb/couch_config_tests.erl +++ b/test/couchdb/couch_config_tests.erl @@ -44,6 +44,9 @@ setup(Chain) -> {ok, Pid} = couch_config:start_link(Chain), Pid. +setup_empty() -> + setup([]). + setup_register() -> ConfigPid = setup(), SentinelFunc = fun() -> @@ -92,7 +95,8 @@ couch_config_test_() -> couch_config_del_tests(), config_override_tests(), config_persistent_changes_tests(), - config_register_tests() + config_register_tests(), + config_no_files_tests() ] }. @@ -195,6 +199,20 @@ config_register_tests() -> } }. +config_no_files_tests() -> + { + "Test couch_config with no files", + { + foreach, + fun setup_empty/0, fun teardown/1, + [ + should_ensure_that_no_ini_files_loaded(), + should_create_non_persistent_option(), + should_create_persistent_option() + ] + } + }. + should_load_all_configs() -> ?_assert(length(couch_config:all()) > 0). @@ -426,3 +444,20 @@ should_not_trigger_handler_after_related_process_death({_, SentinelPid}) -> true end end). + +should_ensure_that_no_ini_files_loaded() -> + ?_assertEqual(0, length(couch_config:all())). + +should_create_non_persistent_option() -> + ?_assertEqual("80", + begin + ok = couch_config:set("httpd", "port", "80", false), + couch_config:get("httpd", "port") + end). + +should_create_persistent_option() -> + ?_assertEqual("127.0.0.1", + begin + ok = couch_config:set("httpd", "bind_address", "127.0.0.1"), + couch_config:get("httpd", "bind_address") + end).