You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2019/08/09 11:58:10 UTC

[couchdb] branch master updated (2b3e2a0 -> dcae3e7)

This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    from 2b3e2a0  Configure environment for Elixir on ARM
     new 0bdf74d  Add timeout for couch_db_split_tests
     new aab0c51  Move couch startup to a fixture
     new 608caaf  Increase default HTTP timeouts
     new dcae3e7  Extend timeout for mrview_purge_docs_fabric

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/test/eunit/couch_db_split_tests.erl      |  3 +-
 .../eunit/couch_mrview_purge_docs_fabric_tests.erl | 10 +--
 .../test/eunit/ddoc_cache_no_cache_test.erl        | 76 +++++++++++-----------
 test/elixir/lib/couch.ex                           | 12 +++-
 4 files changed, 54 insertions(+), 47 deletions(-)


[couchdb] 01/04: Add timeout for couch_db_split_tests

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0bdf74d6dcfdbca8f6b405e2f3e10e011e8d9191
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Tue Aug 6 13:28:47 2019 -0400

    Add timeout for couch_db_split_tests
    
    The "Should copy local docs after split in four" test was occasionally
    timing out in CI.
---
 src/couch/test/eunit/couch_db_split_tests.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/couch/test/eunit/couch_db_split_tests.erl b/src/couch/test/eunit/couch_db_split_tests.erl
index 7d2bb40..c44f47c 100644
--- a/src/couch/test/eunit/couch_db_split_tests.erl
+++ b/src/couch/test/eunit/couch_db_split_tests.erl
@@ -16,6 +16,7 @@
 -include_lib("couch/include/couch_db.hrl").
 
 -define(RINGTOP, 2 bsl 31).
+-define(TIMEOUT, 60). % seconds
 
 
 setup() ->
@@ -68,7 +69,7 @@ should_split_shard({Desc, TotalDocs, Q}, DbName) ->
     TMap = make_targets(Ranges),
     DocsPerRange = TotalDocs div Q,
     PickFun = make_pickfun(DocsPerRange),
-    {Desc, ?_test(begin
+    {Desc, timeout, ?TIMEOUT, ?_test(begin
         {ok, UpdateSeq} = couch_db_split:split(DbName, TMap, PickFun),
         ?assertEqual(ExpectSeq, UpdateSeq),
         maps:map(fun(Range, Name) ->


[couchdb] 03/04: Increase default HTTP timeouts

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 608caaf12904effc104fc86a8525eb51425e2311
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Mon Jul 29 14:48:40 2019 -0400

    Increase default HTTP timeouts
    
    These are needed to avoid timeouts on ASF Jenkins build farm. The
    httpotion client uses ibrowse underneath, and ibrowse has three
    separate timeouts. We are configuring two of them here: the overall
    request timeout, and one that detects inactivity on the connection.
    We set them slightly differently just to be able to differentiate which
    one fired from the logs.
---
 test/elixir/lib/couch.ex | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/elixir/lib/couch.ex b/test/elixir/lib/couch.ex
index 58581b2..3c43ab1 100644
--- a/test/elixir/lib/couch.ex
+++ b/test/elixir/lib/couch.ex
@@ -50,6 +50,14 @@ defmodule Couch do
   CouchDB library to power test suite.
   """
 
+  # These constants are supplied to the underlying HTTP client and control
+  # how long we will wait before timing out a test. The inactivity timeout
+  # specifically fires during an active HTTP response and defaults to 10_000
+  # if not specified. We're defining it to a different value than the
+  # request_timeout largely just so we know which timeout fired.
+  @request_timeout 60_000
+  @inactivity_timeout 55_000
+
   def process_url("http://" <> _ = url) do
     url
   end
@@ -179,13 +187,13 @@ defmodule Couch do
       Keyword.get(
         options,
         :timeout,
-        Application.get_env(:httpotion, :default_timeout, 5000)
+        Application.get_env(:httpotion, :default_timeout, @request_timeout)
       )
 
     ib_options =
       Keyword.merge(
         Application.get_env(:httpotion, :default_ibrowse, []),
-        Keyword.get(options, :ibrowse, [])
+        Keyword.get(options, :ibrowse, [{:inactivity_timeout, @inactivity_timeout}])
       )
 
     follow_redirects =


[couchdb] 02/04: Move couch startup to a fixture

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit aab0c51d8dca39d6556d4636edec20d14f65e36d
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Tue Aug 6 22:46:43 2019 -0400

    Move couch startup to a fixture
    
    This improves reliability because that time isn't charged to the test,
    and also speeds up the test.
---
 .../test/eunit/ddoc_cache_no_cache_test.erl        | 76 +++++++++++-----------
 1 file changed, 37 insertions(+), 39 deletions(-)

diff --git a/src/ddoc_cache/test/eunit/ddoc_cache_no_cache_test.erl b/src/ddoc_cache/test/eunit/ddoc_cache_no_cache_test.erl
index 637a6e8..a1937a0 100644
--- a/src/ddoc_cache/test/eunit/ddoc_cache_no_cache_test.erl
+++ b/src/ddoc_cache/test/eunit/ddoc_cache_no_cache_test.erl
@@ -35,45 +35,43 @@ return_error(_DDocId) ->
     {error, timeout}.
 
 
-start(Resp) ->
-    Ctx = ddoc_cache_tutil:start_couch(),
+no_cache_test_() ->
+    {
+        "ddoc_cache no cache test",
+        {
+            setup,
+            fun ddoc_cache_tutil:start_couch/0, fun ddoc_cache_tutil:stop_couch/1,
+            {
+                foreachx,
+                fun setup/1, fun teardown/2,
+                [
+                    {fun ddoc/1, fun no_cache_open_ok_test/2},
+                    {fun not_found/1, fun no_cache_open_not_found_test/2},
+                    {fun return_error/1, fun no_cache_open_error_test/2}
+                ]
+            }
+        }
+    }.
+
+setup(Resp) ->
     meck:new(fabric),
     meck:expect(fabric, open_doc, fun(_, DDocId, _) ->
         Resp(DDocId)
-    end),
-    Ctx.
-
-
-stop(Ctx) ->
-    meck:unload(),
-    ddoc_cache_tutil:stop_couch(Ctx).
-
-
-no_cache_open_ok_test() ->
-    Ctx = start(fun ddoc/1),
-    try
-        Resp = ddoc_cache:open_doc(<<"foo">>, <<"bar">>),
-        ?assertEqual(ddoc(<<"bar">>), Resp)
-    after
-        stop(Ctx)
-    end.
-
-
-no_cache_open_not_found_test() ->
-    Ctx = start(fun not_found/1),
-    try
-        Resp = ddoc_cache:open_doc(<<"foo">>, <<"bar">>),
-        ?assertEqual(not_found(<<"bar">>), Resp)
-    after
-        stop(Ctx)
-    end.
-
-
-no_cache_open_error_test() ->
-    Ctx = start(fun return_error/1),
-    try
-        Resp = ddoc_cache:open_doc(<<"foo">>, <<"bar">>),
-        ?assertEqual(return_error(<<"bar">>), Resp)
-    after
-        stop(Ctx)
-    end.
+    end).
+
+teardown(_, _) ->
+    meck:unload().
+
+no_cache_open_ok_test(_, _) ->
+    Resp = ddoc_cache:open_doc(<<"foo">>, <<"bar">>),
+    ?_assertEqual(ddoc(<<"bar">>), Resp).
+
+
+no_cache_open_not_found_test(_, _) ->
+    Resp = ddoc_cache:open_doc(<<"foo">>, <<"baz">>),
+    ?_assertEqual(not_found(<<"baz">>), Resp).
+
+
+no_cache_open_error_test(_, _) ->
+    Resp = ddoc_cache:open_doc(<<"foo">>, <<"bif">>),
+    ?_assertEqual(return_error(<<"bif">>), Resp).


[couchdb] 04/04: Extend timeout for mrview_purge_docs_fabric

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit dcae3e7a7ad3a1365f7294b0df488ec2990e4f8b
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Wed Aug 7 17:49:05 2019 -0400

    Extend timeout for mrview_purge_docs_fabric
---
 .../test/eunit/couch_mrview_purge_docs_fabric_tests.erl        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
index 213acac..a593f54 100644
--- a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
+++ b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_fabric_tests.erl
@@ -17,7 +17,7 @@
 -include_lib("mem3/include/mem3.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
--define(TIMEOUT, 1000).
+-define(TIMEOUT, 60). % seconds
 
 
 setup() ->
@@ -56,7 +56,7 @@ view_purge_fabric_test_() ->
 
 
 test_purge_verify_index(DbName) ->
-    ?_test(begin
+    {timeout, ?TIMEOUT, ?_test(begin
         Docs1 = couch_mrview_test_util:make_docs(normal, 5),
         {ok, _} = fabric:update_docs(DbName, Docs1, [?ADMIN_CTX]),
         {ok, _} = fabric:update_doc(
@@ -99,11 +99,11 @@ test_purge_verify_index(DbName) ->
         ?assertEqual(1, couch_util:get_value(<<"purge_seq">>, Props2)),
         ?assertEqual(true, couch_mrview_index:verify_index_exists(
             ShardDbName, Props2))
-    end).
+    end)}.
 
 
 test_purge_hook_before_compaction(DbName) ->
-    ?_test(begin
+    {timeout, ?TIMEOUT, ?_test(begin
         Docs1 = couch_mrview_test_util:make_docs(normal, 5),
         {ok, _} = fabric:update_docs(DbName, Docs1, [?ADMIN_CTX]),
         {ok, _} = fabric:update_doc(
@@ -198,7 +198,7 @@ test_purge_hook_before_compaction(DbName) ->
 
         {ok, #doc{body = {Props4}}} = get_local_purge_doc(DbName),
         ?assertEqual(2, couch_util:get_value(<<"purge_seq">>, Props4))
-    end).
+    end)}.
 
 
 get_local_purge_doc(DbName) ->