couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [24/36] couchdb commit: updated refs/heads/1963-eunit to 85f2750
Date Tue, 03 Jun 2014 15:55:02 GMT
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/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c8cdb7ff
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c8cdb7ff
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c8cdb7ff

Branch: refs/heads/1963-eunit
Commit: c8cdb7ff2514cd8c3fc847f27b3723c9f05f4459
Parents: 63ba46d
Author: Alexander Shorin <kxepal@apache.org>
Authored: Mon May 26 09:46:06 2014 +0400
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Tue Jun 3 19:51:33 2014 +0400

----------------------------------------------------------------------
 test/couchdb/couch_config_tests.erl | 37 +++++++++++++++++++++-
 test/etap/083-config-no-files.t     | 53 --------------------------------
 test/etap/Makefile.am               |  1 -
 3 files changed, 36 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c8cdb7ff/test/couchdb/couch_config_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb/couch_config_tests.erl b/test/couchdb/couch_config_tests.erl
index 1e5d99e..ec2ee21 100644
--- a/test/couchdb/couch_config_tests.erl
+++ b/test/couchdb/couch_config_tests.erl
@@ -41,6 +41,9 @@ setup(Chain) ->
     {ok, Pid} = couch_config:start_link(Chain),
     Pid.
 
+setup_empty() ->
+    setup([]).
+
 setup_register() ->
     ConfigPid = setup(),
     SentinelFunc = fun() ->
@@ -89,7 +92,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()
         ]
     }.
 
@@ -192,6 +196,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).
@@ -447,3 +465,20 @@ should_not_trigger_handler_after_related_process_death({_, SentinelPid})
->
             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).

http://git-wip-us.apache.org/repos/asf/couchdb/blob/c8cdb7ff/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
deleted file mode 100755
index 0ce38e6..0000000
--- a/test/etap/083-config-no-files.t
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env escript
-%% -*- erlang -*-
-
-% Licensed 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.
-
-
-main(_) ->
-    test_util:init_code_path(),
-    etap:plan(3),
-    case (catch test()) of
-        ok ->
-            etap:end_tests();
-        Other ->
-            etap:diag(io_lib:format("Test died abnormally: ~p", [Other])),
-            etap:bail(Other)
-    end,
-    ok.
-
-test() ->
-    couch_config:start_link([]),
-
-    etap:fun_is(
-        fun(KVPairs) -> length(KVPairs) == 0 end,
-        couch_config:all(),
-        "No INI files specified returns 0 key/value pairs."
-    ),
-
-    ok = couch_config:set("httpd", "port", "80", false),
-
-    etap:is(
-        couch_config:get("httpd", "port"),
-        "80",
-        "Created a new non-persisted k/v pair."
-    ),
-
-    ok = couch_config:set("httpd", "bind_address", "127.0.0.1"),
-    etap:is(
-        couch_config:get("httpd", "bind_address"),
-        "127.0.0.1",
-        "Asking for a persistent key/value pair doesn't choke."
-    ),
-
-    ok.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/c8cdb7ff/test/etap/Makefile.am
----------------------------------------------------------------------
diff --git a/test/etap/Makefile.am b/test/etap/Makefile.am
index 25889f4..091dae9 100644
--- a/test/etap/Makefile.am
+++ b/test/etap/Makefile.am
@@ -36,7 +36,6 @@ fixture_files = \
     fixtures/test.couch
 
 tap_files = \
-    083-config-no-files.t \
     090-task-status.t \
     100-ref-counter.t \
     120-stats-collect.t \


Mime
View raw message