You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2017/05/20 11:36:19 UTC

[couchdb] 03/03: better test as per @nickva

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

jan pushed a commit to branch 3406/improve-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e5d3db1640b1a2b851db5bf5c90a423db8bc170e
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Sat May 20 13:31:27 2017 +0200

    better test as per @nickva
---
 .../test/couch_replicator_compact_tests.erl              | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/couch_replicator/test/couch_replicator_compact_tests.erl b/src/couch_replicator/test/couch_replicator_compact_tests.erl
index 3e6bb9e..6823037 100644
--- a/src/couch_replicator/test/couch_replicator_compact_tests.erl
+++ b/src/couch_replicator/test/couch_replicator_compact_tests.erl
@@ -24,7 +24,7 @@
 -define(ATTFILE, filename:join([?FIXTURESDIR, "logo.png"])).
 -define(DELAY, 100).
 -define(TIMEOUT, 30000).
--define(TIMEOUT_WRITER, 9000).
+-define(TIMEOUT_WRITER, 30000).
 -define(TIMEOUT_EUNIT, ?TIMEOUT div 1000 + 70).
 
 setup() ->
@@ -113,7 +113,9 @@ check_active_tasks(RepPid, {BaseId, Ext} = RepId, Src, Tgt) ->
     FullRepId = ?l2b(BaseId ++ Ext),
     Pid = ?l2b(pid_to_list(RepPid)),
     ok = wait_for_replicator(RepId),
-    [RepTask] = couch_task_status:all(),
+    RepTasks = wait_for_task_status(),
+    ?assertNotEqual(timeout, RepTasks),
+    [RepTask] = RepTasks,
     ?assertEqual(Pid, couch_util:get_value(pid, RepTask)),
     ?assertEqual(FullRepId, couch_util:get_value(replication_id, RepTask)),
     ?assertEqual(true, couch_util:get_value(continuous, RepTask)),
@@ -140,6 +142,16 @@ wait_for_replicator(RepId) ->
     ?assertMatch({ok, _}, rep_details(RepId)),
     ok.
 
+wait_for_task_status() ->
+    test_util:wait(fun() ->
+        case couch_task_status:all() of
+            [] ->
+                wait;
+            Tasks ->
+                Tasks
+        end
+    end).
+
 should_cancel_replication(RepId, RepPid) ->
     ?_assertNot(begin
         ok = couch_replicator_scheduler:remove_job(RepId),

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