couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [couchdb] branch 3406/improve-tests updated: better test as per @nickva
Date Sat, 20 May 2017 11:44:01 GMT
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 <jan@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" <commits@couchdb.apache.org>'].

Mime
View raw message