diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2020-07-28 16:10:05 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2020-07-28 16:33:50 -0400 |
commit | 77e1c8c2bc93e07f2508ef4fb8dd7476ccd59425 (patch) | |
tree | 900c5af8996a001df37bf1e60774afd876ff25ac | |
parent | 0c7c77eb59d626505cf6ec4162e1053837bc3593 (diff) | |
download | couchdb-77e1c8c2bc93e07f2508ef4fb8dd7476ccd59425.tar.gz |
Use _scheduler/jobs instead of _active_tasks in replication Elixir tests
After _active_tasks was implemented on FDB, single-node (previous)
_active_tasks implementation, had stopped working. It turns out were were
relying on it to run Elixir replication tests.
To not lose test coverage, and before we implement replicator on FDB, switch
the tests to use `_scheduler/jobs`.
-rw-r--r-- | test/elixir/test/replication_test.exs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/elixir/test/replication_test.exs b/test/elixir/test/replication_test.exs index 78f36602d..8b657d916 100644 --- a/test/elixir/test/replication_test.exs +++ b/test/elixir/test/replication_test.exs @@ -127,7 +127,7 @@ defmodule ReplicationTest do task = get_task(repl_id, 3_000) assert is_map(task) - assert task["replication_id"] == repl_id + assert task["id"] == repl_id repl_body = %{ "replication_id" => repl_id, @@ -1749,8 +1749,13 @@ defmodule ReplicationTest do def wait_for_repl(src_db_name, repl_id, expect_revs_checked, wait_left) do task = get_task(repl_id, 0) - through_seq = task["through_seq"] || "0" - revs_checked = task["revisions_checked"] + info = if task["info"] == :null do + %{"through_seq" => "0", "revisions_checked" => "0"} + else + task["info"] + end + through_seq = info["through_seq"] || "0" + revs_checked = info["revisions_checked"] || "0" changes = get_db_changes(src_db_name, %{:since => through_seq}) if length(changes["results"]) > 0 or revs_checked < expect_revs_checked do @@ -1799,13 +1804,14 @@ defmodule ReplicationTest do end def try_get_task(repl_id) do - resp = Couch.get("/_active_tasks") - assert HTTPotion.Response.success?(resp) - assert is_list(resp.body) + resp = Couch.get("/_scheduler/jobs/#{repl_id}") - Enum.find(resp.body, nil, fn task -> - task["replication_id"] == repl_id - end) + if HTTPotion.Response.success?(resp) do + assert is_map(resp.body) + resp.body + else + nil + end end def set_user(uri, userinfo) do |