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

[42/50] [abbrv] couch commit: updated refs/heads/master to 55e98c4

Add couch_eunit.hrl


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

Branch: refs/heads/master
Commit: 32ba7c226a1b24fa0ef41c6bd73d98d11511c901
Parents: 458dc3b
Author: Russell Branca <ch...@apache.org>
Authored: Fri Aug 15 13:12:06 2014 -0700
Committer: Russell Branca <ch...@apache.org>
Committed: Thu Sep 4 14:37:34 2014 -0700

----------------------------------------------------------------------
 include/couch_eunit.hrl                 | 54 ++++++++++++++++++++++++++++
 test/couch_auth_cache_tests.erl         |  1 -
 test/couch_changes_tests.erl            |  1 -
 test/couchdb_compaction_daemon.erl      |  1 -
 test/couchdb_cors_tests.erl             |  1 -
 test/couchdb_file_compression_tests.erl |  1 -
 test/couchdb_update_conflicts_tests.erl |  1 -
 test/couchdb_vhosts_tests.erl           |  1 -
 test/couchdb_views_tests.erl            |  1 -
 9 files changed, 54 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/include/couch_eunit.hrl
----------------------------------------------------------------------
diff --git a/include/couch_eunit.hrl b/include/couch_eunit.hrl
new file mode 100644
index 0000000..d6d7278
--- /dev/null
+++ b/include/couch_eunit.hrl
@@ -0,0 +1,54 @@
+% 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.
+
+-include_lib("eunit/include/eunit.hrl").
+
+-define(ADMIN_ROLE, #user_ctx{roles=[<<"_admin">>]}).
+-define(ADMIN_USER, {user_ctx, ?ADMIN_ROLE}).
+
+-define(BUILDDIR,
+    fun() ->
+        case os:getenv("BUILDDIR") of
+            false ->
+                throw("BUILDDIR environment variable must be set");
+            Dir ->
+                Dir
+        end
+    end).
+-define(CONFIG_CHAIN, [
+    filename:join([?BUILDDIR(), "etc", "couchdb", "default_dev.ini"]),
+    filename:join([?BUILDDIR(), "etc", "couchdb", "local_dev.ini"]),
+    filename:join([?BUILDDIR(), "etc", "couchdb", "eunit.ini"])]).
+-define(FIXTURESDIR,
+    filename:join([?BUILDDIR(), "src", "couch", "test", "fixtures"])).
+-define(TEMPDIR,
+    filename:join([?BUILDDIR(), "test", "temp"])).
+
+-define(tempfile,
+    fun() ->
+        {A, B, C} = erlang:now(),
+        N = node(),
+        FileName = lists:flatten(io_lib:format("~p-~p.~p.~p", [N, A, B, C])),
+        filename:join([?TEMPDIR, FileName])
+    end).
+-define(tempdb,
+    fun() ->
+            Nums = tuple_to_list(erlang:now()),
+            Prefix = "eunit-test-db",
+            Suffix = lists:concat([integer_to_list(Num) || Num <- Nums]),
+            list_to_binary(Prefix ++ "-" ++ Suffix)
+    end).
+-define(docid,
+    fun() ->
+        {A, B, C} = erlang:now(),
+        lists:flatten(io_lib:format("~p~p~p", [A, B, C]))
+    end).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couch_auth_cache_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_auth_cache_tests.erl b/test/couch_auth_cache_tests.erl
index 83531ff..afad552 100644
--- a/test/couch_auth_cache_tests.erl
+++ b/test/couch_auth_cache_tests.erl
@@ -15,7 +15,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(SALT, <<"SALT">>).
 -define(TIMEOUT, 1000).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couch_changes_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_changes_tests.erl b/test/couch_changes_tests.erl
index 3ae1b52..64754fa 100644
--- a/test/couch_changes_tests.erl
+++ b/test/couch_changes_tests.erl
@@ -15,7 +15,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles = [<<"_admin">>]}}).
 -define(TIMEOUT, 3000).
 -define(TEST_TIMEOUT, 10000).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_compaction_daemon.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_compaction_daemon.erl b/test/couchdb_compaction_daemon.erl
index 24c5d7b..0d2195b 100644
--- a/test/couchdb_compaction_daemon.erl
+++ b/test/couchdb_compaction_daemon.erl
@@ -15,7 +15,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(DELAY, 100).
 -define(TIMEOUT, 30000).
 -define(TIMEOUT_S, ?TIMEOUT div 1000).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_cors_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_cors_tests.erl b/test/couchdb_cors_tests.erl
index 52d1797..cfdbd63 100644
--- a/test/couchdb_cors_tests.erl
+++ b/test/couchdb_cors_tests.erl
@@ -16,7 +16,6 @@
 -include_lib("couch/include/couch_db.hrl").
 
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(SUPPORTED_METHODS,
         "GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, COPY, OPTIONS").
 -define(TIMEOUT, 1000).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_file_compression_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_file_compression_tests.erl b/test/couchdb_file_compression_tests.erl
index 5b12882..8f590b9 100644
--- a/test/couchdb_file_compression_tests.erl
+++ b/test/couchdb_file_compression_tests.erl
@@ -15,7 +15,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(DDOC_ID, <<"_design/test">>).
 -define(DOCS_COUNT, 5000).
 -define(TIMEOUT, 30000).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_update_conflicts_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_update_conflicts_tests.erl b/test/couchdb_update_conflicts_tests.erl
index 7ac1187..58d6014 100644
--- a/test/couchdb_update_conflicts_tests.erl
+++ b/test/couchdb_update_conflicts_tests.erl
@@ -16,7 +16,6 @@
 -include_lib("couch/include/couch_db.hrl").
 
 -define(i2l(I), integer_to_list(I)).
--define(ADMIN_USER, {userctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(DOC_ID, <<"foobar">>).
 -define(NUM_CLIENTS, [100, 500, 1000, 2000, 5000, 10000]).
 -define(TIMEOUT, 10000).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_vhosts_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_vhosts_tests.erl b/test/couchdb_vhosts_tests.erl
index 321012f..5eb266c 100644
--- a/test/couchdb_vhosts_tests.erl
+++ b/test/couchdb_vhosts_tests.erl
@@ -15,7 +15,6 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(TIMEOUT, 1000).
 -define(iofmt(S, A), lists:flatten(io_lib:format(S, A))).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/32ba7c22/test/couchdb_views_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_views_tests.erl b/test/couchdb_views_tests.erl
index 03fb9cc..012d12e 100644
--- a/test/couchdb_views_tests.erl
+++ b/test/couchdb_views_tests.erl
@@ -16,7 +16,6 @@
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
--define(ADMIN_USER, {user_ctx, #user_ctx{roles=[<<"_admin">>]}}).
 -define(DELAY, 100).
 -define(TIMEOUT, 1000).