diff options
author | ILYA Khlopotov <iilyak@apache.org> | 2017-05-19 06:47:54 -0700 |
---|---|---|
committer | ILYA Khlopotov <iilyak@apache.org> | 2017-05-19 06:54:44 -0700 |
commit | 27f5067c853f9cb8d124328e7844b27d04630d94 (patch) | |
tree | 058da16f0d3e0ace5f736cc3ac90b8743b54e668 | |
parent | 1fa3f58b5733031b2e73e68f921e364ff6533689 (diff) | |
download | couchdb-27f5067c853f9cb8d124328e7844b27d04630d94.tar.gz |
Filter out non replicator tasks in test case
Previously the test relied in the assumption that there are no
couch_tasks are running concurrently. This commit fixes that assumption
by filtering out all non replication related tasks from the output of
couch_task_status:all().
-rw-r--r-- | src/couch_replicator/test/couch_replicator_compact_tests.erl | 8 |
1 files changed, 6 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 d243b1c09..a1b38a889 100644 --- a/src/couch_replicator/test/couch_replicator_compact_tests.erl +++ b/src/couch_replicator/test/couch_replicator_compact_tests.erl @@ -113,7 +113,7 @@ 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(), + [RepTask] = replication_tasks(), ?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)), @@ -129,10 +129,14 @@ check_active_tasks(RepPid, {BaseId, Ext} = RepId, Src, Tgt) -> Pending = couch_util:get_value(changes_pending, RepTask), ?assert(is_integer(Pending)). - rep_details(RepId) -> gen_server:call(get_pid(RepId), get_details). +replication_tasks() -> + lists:filter(fun(P) -> + couch_util:get_value(type, P) =:= replication + end, couch_task_status:all()). + wait_for_replicator(RepId) -> %% since replicator started asynchronously %% we need to wait when it would be in couch_task_status |