summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2017-07-18 14:54:55 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2017-07-18 15:27:17 -0400
commitc8bf463139adc53187626f34d3ac4ffbc9352ca8 (patch)
treeb9020247078441cf829a49bc330b163030d4f9e9
parentb0a2fe8851c73d6053666981ca67479d15b7a089 (diff)
downloadcouchdb-c8bf463139adc53187626f34d3ac4ffbc9352ca8.tar.gz
Remove get_details replicator job gen_server call
This was used from a test only and it wasn't reliable. Because of replicator job delays initialization the `State` would be either #rep_state{} or #rep. If replication job hasn't finished initializing, then state would be #rep{} and a call like get_details which matches the state with #rep_state{] would fail with the batmatch error. As seen in issue #686 So remove `get_details` call and let the test rely on task polling as all other tests do.
-rw-r--r--src/couch_replicator/src/couch_replicator_scheduler_job.erl3
-rw-r--r--src/couch_replicator/test/couch_replicator_compact_tests.erl10
2 files changed, 0 insertions, 13 deletions
diff --git a/src/couch_replicator/src/couch_replicator_scheduler_job.erl b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
index 66bfdbff7..88abe7c66 100644
--- a/src/couch_replicator/src/couch_replicator_scheduler_job.erl
+++ b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
@@ -215,9 +215,6 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx} = Rep) ->
}.
-handle_call(get_details, _From, #rep_state{rep_details = Rep} = State) ->
- {reply, {ok, Rep}, State};
-
handle_call({add_stats, Stats}, From, State) ->
gen_server:reply(From, ok),
NewStats = couch_replicator_utils:sum_stats(State#rep_state.stats, Stats),
diff --git a/src/couch_replicator/test/couch_replicator_compact_tests.erl b/src/couch_replicator/test/couch_replicator_compact_tests.erl
index 1a794658a..28f46e423 100644
--- a/src/couch_replicator/test/couch_replicator_compact_tests.erl
+++ b/src/couch_replicator/test/couch_replicator_compact_tests.erl
@@ -112,7 +112,6 @@ check_active_tasks(RepPid, {BaseId, Ext} = RepId, Src, Tgt) ->
end,
FullRepId = ?l2b(BaseId ++ Ext),
Pid = ?l2b(pid_to_list(RepPid)),
- ok = wait_for_replicator(RepId),
RepTasks = wait_for_task_status(),
?assertNotEqual(timeout, RepTasks),
[RepTask] = RepTasks,
@@ -131,20 +130,11 @@ 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
- %% we query replicator:details to ensure that do_init happen
- ?assertMatch({ok, _}, rep_details(RepId)),
- ok.
wait_for_task_status() ->
test_util:wait(fun() ->