You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2014/08/11 22:22:57 UTC

[21/50] [abbrv] couch commit: updated refs/heads/1963-eunit-bigcouch to 661443f

Port 077-couch-db-fast-db-delete-create.t etap test suite to eunit

Merged into couch_db_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/3b3fe75a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/3b3fe75a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/3b3fe75a

Branch: refs/heads/1963-eunit-bigcouch
Commit: 3b3fe75a4ac61ae5048072d56420b2562e4044f6
Parents: 06c6e2e
Author: Alexander Shorin <kx...@apache.org>
Authored: Thu May 22 20:31:09 2014 +0400
Committer: Russell Branca <ch...@apache.org>
Committed: Mon Aug 11 13:22:07 2014 -0700

----------------------------------------------------------------------
 test/couchdb/couch_db_tests.erl | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/3b3fe75a/test/couchdb/couch_db_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb/couch_db_tests.erl b/test/couchdb/couch_db_tests.erl
index 2b781ed..3089714 100644
--- a/test/couchdb/couch_db_tests.erl
+++ b/test/couchdb/couch_db_tests.erl
@@ -14,9 +14,12 @@
 
 -include("couch_eunit.hrl").
 
+-define(TIMEOUT, 120).
+
 
 setup() ->
     {ok, _} = couch_server_sup:start_link(?CONFIG_CHAIN),
+    couch_config:set("log", "include_sasl", "false", false),
     ok.
 
 teardown(_) ->
@@ -33,7 +36,8 @@ create_delete_db_test_()->
                 [should_create_db(),
                  should_delete_db(),
                  should_create_multiple_dbs(),
-                 should_delete_multiple_dbs()]
+                 should_delete_multiple_dbs(),
+                 should_create_delete_database_continuously()]
             end
         }
     }.
@@ -88,3 +92,23 @@ should_delete_multiple_dbs() ->
     end, 0, DbNames),
 
     ?_assertEqual(NumDeleted, 6).
+
+should_create_delete_database_continuously() ->
+    DbName = ?tempdb(),
+    {ok, Db} = couch_db:create(DbName, []),
+    couch_db:close(Db),
+    [{timeout, ?TIMEOUT, {integer_to_list(N) ++ " times",
+                           ?_assert(loop(DbName, N))}}
+     || N <- [10, 100, 1000]].
+
+loop(_, 0) ->
+    true;
+loop(DbName, N) ->
+    ok = cycle(DbName),
+    loop(DbName, N - 1).
+
+cycle(DbName) ->
+    ok = couch_server:delete(DbName, []),
+    {ok, Db} = couch_db:create(DbName, []),
+    couch_db:close(Db),
+    ok.