couchdb-commits mailing list archives

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

Branch: refs/heads/1963-eunit
Commit: cfc6f6a1dd72cf10dc718c70f8e2a6ed0e2535c0
Parents: db5d227
Author: Alexander Shorin <kxepal@apache.org>
Authored: Thu May 22 20:31:09 2014 +0400
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Tue Jun 3 15:14:26 2014 +0400

----------------------------------------------------------------------
 test/couchdb/couch_db_tests.erl                | 22 +++++++-
 test/etap/077-couch-db-fast-db-delete-create.t | 61 ---------------------
 test/etap/Makefile.am                          |  1 -
 3 files changed, 21 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/cfc6f6a1/test/couchdb/couch_db_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb/couch_db_tests.erl b/test/couchdb/couch_db_tests.erl
index d651126..5fd40d7 100644
--- a/test/couchdb/couch_db_tests.erl
+++ b/test/couchdb/couch_db_tests.erl
@@ -14,6 +14,7 @@
 
 -include_lib("couchdb_tests.hrl").
 
+-define(TIMETOUT, 1200000).
 
 setup() ->
     {ok, _} = couch_server_sup:start_link(?CONFIG_CHAIN),
@@ -33,7 +34,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 +90,21 @@ should_delete_multiple_dbs() ->
     end, 0, DbNames),
 
     ?_assertEqual(NumDeleted, 6).
+
+should_create_delete_database_continuously() ->
+    DbName = ?tempdb(),
+    {ok, _} = couch_db:create(DbName, []),
+    [{timeout, ?TIMETOUT div 1000, {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, []),
+    ok.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cfc6f6a1/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 2026698..0000000
--- a/test/etap/077-couch-db-fast-db-delete-create.t
+++ /dev/null
@@ -1,61 +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(unknown),
-    case (catch test()) of
-        ok ->
-            etap:end_tests();
-        Other ->
-            Msg = io_lib:format("Test died abnormally: ~p", [Other]),
-            etap:diag(Msg),
-            etap:bail(Msg)
-        end,
-    ok.
-
-loop(0) ->
-    ok;
-loop(N) ->
-    ok = cycle(),
-    loop(N - 1).
-
-cycle() ->
-    ok = couch_server:delete(<<"etap-test-db">>, []),
-    {ok, _Db} = couch_db:create(<<"etap-test-db">>, []),
-    ok.
-
-test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-
-    {ok, _Db} = couch_db:create(<<"etap-test-db">>, []),
-
-    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),
-
-    ok = couch_server:delete(<<"etap-test-db">>, []),
-
-    etap:is(true, true, "lots of creating and deleting of a database"),
-    ok.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cfc6f6a1/test/etap/Makefile.am
----------------------------------------------------------------------
diff --git a/test/etap/Makefile.am b/test/etap/Makefile.am
index d950e46..3d0ad08 100644
--- a/test/etap/Makefile.am
+++ b/test/etap/Makefile.am
@@ -36,7 +36,6 @@ fixture_files = \
     fixtures/test.couch
 
 tap_files = \
-    077-couch-db-fast-db-delete-create.t \
     080-config-get-set.t \
     081-config-override.1.ini \
     081-config-override.2.ini \


Mime
View raw message