summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2017-07-22 00:48:34 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2017-07-24 11:13:45 -0400
commit351679b56e6d3a2f9c1b48527c0a20eeb655210b (patch)
tree37908151533fefb4ee7ecaf57a9f8943e8d46a01
parenta666d570afc805778347441e516bcdd04d1d57a7 (diff)
downloadcouchdb-351679b56e6d3a2f9c1b48527c0a20eeb655210b.tar.gz
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
-rw-r--r--src/couch/test/couch_db_mpr_tests.erl45
1 files 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 792901bf2..bb97c66d7 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) ->