You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/07/24 15:13:48 UTC

[couchdb] branch master updated: Increase timeout in couch's couch_db_mpr_tests module to 30 seconds

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 351679b  Increase timeout in couch's couch_db_mpr_tests module to 30 seconds
351679b is described below

commit 351679b56e6d3a2f9c1b48527c0a20eeb655210b
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Sat Jul 22 00:48:34 2017 -0400

    Increase timeout in couch's couch_db_mpr_tests module to 30 seconds
    
    Previous default timeout of 5 seconds was not enough when running in an
    environment where disk access is severly throttled.
    
    To add a timeout, changed the test function into a test generator. That also
    made the `with` construct un-necessary.
    
    Fixes #695
---
 src/couch/test/couch_db_mpr_tests.erl | 45 +++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/couch/test/couch_db_mpr_tests.erl b/src/couch/test/couch_db_mpr_tests.erl
index 792901b..bb97c66 100644
--- a/src/couch/test/couch_db_mpr_tests.erl
+++ b/src/couch/test/couch_db_mpr_tests.erl
@@ -16,6 +16,7 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
+-define(TIMEOUT, 30).
 
 -define(USER, "couch_db_admin").
 -define(PASS, "pass").
@@ -69,34 +70,36 @@ couch_db_mpr_test_() ->
                 foreach,
                 fun setup/0,
                 fun teardown/1,
-                [{with, [
+                [
                     fun recreate_with_mpr/1
-                ]}]
+                ]
             }
         }
     }.
 
 
 recreate_with_mpr(Url) ->
-    DocId1 = "foo",
-    DocId2 = "bar",
-
-    create_db(Url),
-    create_and_delete_doc(Url, DocId1),
-    Rev1 = create_with_mpr(Url, DocId1),
-    delete_db(Url),
-
-    create_db(Url),
-    create_and_delete_doc(Url, DocId1),
-    % We create a second unrelated doc to change the
-    % position on disk where the attachment is written
-    % so that we can assert that the position on disk
-    % is not included when calculating a revision.
-    create_and_delete_doc(Url, DocId2),
-    Rev2 = create_with_mpr(Url, DocId1),
-    delete_db(Url),
-
-    ?assertEqual(Rev1, Rev2).
+    {timeout, ?TIMEOUT, ?_test(begin
+        DocId1 = "foo",
+        DocId2 = "bar",
+
+        create_db(Url),
+        create_and_delete_doc(Url, DocId1),
+        Rev1 = create_with_mpr(Url, DocId1),
+        delete_db(Url),
+
+        create_db(Url),
+        create_and_delete_doc(Url, DocId1),
+        % We create a second unrelated doc to change the
+        % position on disk where the attachment is written
+        % so that we can assert that the position on disk
+        % is not included when calculating a revision.
+        create_and_delete_doc(Url, DocId2),
+        Rev2 = create_with_mpr(Url, DocId1),
+        delete_db(Url),
+
+        ?assertEqual(Rev1, Rev2)
+    end)}.
 
 
 create_and_delete_doc(Url, DocId) ->

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].