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:44:01 UTC

[couchdb] branch 3406/improve-tests updated: 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

The following commit(s) were added to refs/heads/3406/improve-tests by this push:
       new  2b5e1ad   better test as per @nickva
2b5e1ad is described below

commit 2b5e1adea030b71d731a59228231436ee63df7eb
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                | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/couch_replicator/test/couch_replicator_compact_tests.erl b/src/couch_replicator/test/couch_replicator_compact_tests.erl
index a1b38a8..c99335d 100644
--- a/src/couch_replicator/test/couch_replicator_compact_tests.erl
+++ b/src/couch_replicator/test/couch_replicator_compact_tests.erl
@@ -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] = replication_tasks(),
+    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)),
@@ -144,6 +146,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>'].