summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2017-05-20 13:31:27 +0200
committerJan Lehnardt <jan@apache.org>2017-05-20 14:10:10 +0200
commitaca6a459e454aa684cb864901899a3320a0c2480 (patch)
tree395cc9c303f0147264539c39d34bc4fb449e983b
parenta924dfea1ca1824f860d70c8eca1dff15cf0a16e (diff)
downloadcouchdb-aca6a459e454aa684cb864901899a3320a0c2480.tar.gz
better test as per @nickva
-rw-r--r--src/couch_replicator/test/couch_replicator_compact_tests.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/couch_replicator/test/couch_replicator_compact_tests.erl b/src/couch_replicator/test/couch_replicator_compact_tests.erl
index a1b38a889..c99335d3d 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),