summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2019-04-10 11:45:59 -0400
committerNick Vatamaniuc <vatamane@apache.org>2019-04-10 11:45:59 -0400
commitd721638eb008cd6ef07671ef0c2ac3f87859d337 (patch)
tree3debc6f83541b4186ecb29c5416d4d09536664a2
parent52189ee31da91a0c06c7840ba5398e64cb31d1c3 (diff)
downloadcouchdb-fix-resharding-elixir-test.tar.gz
In the resharding API test pick the first live nodefix-resharding-elixir-test
Previously the first cluster node was picked. However, when running a test with a degraded cluster and that node is down the test would fail.
-rw-r--r--test/elixir/test/reshard_helpers.exs9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/elixir/test/reshard_helpers.exs b/test/elixir/test/reshard_helpers.exs
index c67e6902e..52ce301df 100644
--- a/test/elixir/test/reshard_helpers.exs
+++ b/test/elixir/test/reshard_helpers.exs
@@ -83,9 +83,12 @@ defmodule ReshardHelpers do
def get_first_node do
mresp = Couch.get("/_membership")
assert mresp.status_code == 200
- cluster_nodes = mresp.body["cluster_nodes"]
- [node1 | _] = cluster_nodes
- node1
+ all_nodes = mresp.body["all_nodes"]
+
+ mresp.body["cluster_nodes"]
+ |> Enum.filter(fn n -> n in all_nodes end)
+ |> Enum.sort()
+ |> hd()
end
def wait_job_removed(id) do