couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [17/43] couchdb commit: updated refs/heads/1963-eunit-bigcouch to 424dca5
Date Mon, 21 Jul 2014 23:57:30 GMT
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/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4e383ca6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4e383ca6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4e383ca6

Branch: refs/heads/1963-eunit-bigcouch
Commit: 4e383ca6227157b5ed90da63b41fb8de44d97b7c
Parents: 214ea4c
Author: Alexander Shorin <kxepal@apache.org>
Authored: Thu May 22 20:31:09 2014 +0400
Committer: Russell Branca <chewbranca@apache.org>
Committed: Mon Jul 21 16:43:14 2014 -0700

----------------------------------------------------------------------
 test/couchdb/couch_db_tests.erl                | 26 ++++++++++-
 test/etap/077-couch-db-fast-db-delete-create.t | 50 ---------------------
 2 files changed, 25 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4e383ca6/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.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4e383ca6/test/etap/077-couch-db-fast-db-delete-create.t
----------------------------------------------------------------------
diff --git a/test/etap/077-couch-db-fast-db-delete-create.t b/test/etap/077-couch-db-fast-db-delete-create.t
deleted file mode 100644
index 4ba5c56..0000000
--- a/test/etap/077-couch-db-fast-db-delete-create.t
+++ /dev/null
@@ -1,50 +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:run(1, fun() -> test() end).
-
-
-loop(0) ->
-    ok;
-loop(N) ->
-    ok = cycle(),
-    loop(N - 1).
-
-
-cycle() ->
-    {ok, Db} = couch_db:create(<<"etap-test-db">>, []),
-    % Dirty but only less dirty than importing the #db{} record
-    couch_file:close(element(5, Db)),
-    ok = couch_server:delete(<<"etap-test-db">>, [sync]),
-    ok.
-
-
-test() ->
-    test_util:start_couch(),
-
-    ok = loop(1),
-    ok = loop(10),
-    ok = loop(100),
-    ok = loop(1000),
-
-    % for more thorough testing:
-    % ok = loop(10000),
-    % ok = loop(100000),
-    % ok = loop(1000000),
-    % ok = loop(10000000),
-
-    etap:is(true, true, "lots of creating and deleting of a database"),
-    ok.


Mime
View raw message