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 12:13:49 UTC

[couchdb] 07/09: better test as per @nickva

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

jan pushed a commit to branch 2.1.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 9769cf09606c39afac696eda346a74844713be51
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 f16de44..a4c1b3f 100644
--- a/src/couch_replicator/test/couch_replicator_compact_tests.erl
+++ b/src/couch_replicator/test/couch_replicator_compact_tests.erl
@@ -107,8 +107,10 @@ check_active_tasks(RepPid, {BaseId, Ext} = _RepId, Src, Tgt) ->
     end,
     FullRepId = ?l2b(BaseId ++ Ext),
     Pid = ?l2b(pid_to_list(RepPid)),
-    ok = wait_for_replicator(RepPid),
-    [RepTask] = couch_task_status:all(),
+    ok = wait_for_replicator(RepId),
+    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)),
@@ -131,6 +133,16 @@ wait_for_replicator(Pid) ->
     ?assertMatch({ok, _}, couch_replicator:details(Pid)),
     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:cancel_replication(RepId),

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