couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [2/4] couch commit: updated refs/heads/master to c38ab6b
Date Tue, 24 Nov 2015 20:37:13 GMT
Ensure _global_changes exists

Downstream builds automatically ensure _global_changes exists, so this commit works for both
cases

COUCHDB-2898


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

Branch: refs/heads/master
Commit: 5df95158d00bb0a72f62b13d9468dd47e5c6b95d
Parents: c7ecd2b
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Sun Nov 22 11:01:04 2015 -0800
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Sun Nov 22 11:01:04 2015 -0800

----------------------------------------------------------------------
 test/global_changes_tests.erl | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5df95158/test/global_changes_tests.erl
----------------------------------------------------------------------
diff --git a/test/global_changes_tests.erl b/test/global_changes_tests.erl
index a37a524..6054128 100644
--- a/test/global_changes_tests.erl
+++ b/test/global_changes_tests.erl
@@ -23,14 +23,10 @@ setup() ->
     Host = get_host(),
     ok = add_admin(?USER, ?PASS),
     DbName = "foo/" ++ ?b2l(?tempdb()),
-    [fabric:create_db(Name, [?ADMIN_CTX])
-        || Name <- ["_global_changes", DbName]],
     ok = http_create_db(DbName),
     {Host, DbName}.
 
 teardown({_, DbName}) ->
-    [fabric:delete_db(Name, [?ADMIN_CTX])
-        || Name <- ["_global_changes", DbName]],
     ok = http_delete_db(DbName),
     delete_admin(?USER),
     ok.
@@ -48,12 +44,25 @@ http_delete_db(Name) ->
 db_url(Name) ->
     get_host() ++ "/" ++ escape(Name).
 
+start_couch() ->
+    Ctx = test_util:start_couch([chttpd, global_changes]),
+    ok = ensure_db_exists("_global_changes"),
+    Ctx.
+
+ensure_db_exists(Name) ->
+    case fabric:create_db(Name) of
+        ok ->
+            ok;
+        {error, file_exists} ->
+            ok
+    end.
+
 global_changes_test_() ->
     {
         "Checking global_changes endpoint",
         {
             setup,
-            fun() -> test_util:start_couch([chttpd, global_changes]) end,
+            fun start_couch/0,
             fun test_util:stop/1,
             [
                 check_response()


Mime
View raw message