diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2019-04-10 11:45:59 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2019-04-10 13:45:45 -0400 |
commit | ae261e44a5106dd881711b90bd1528fad6db925f (patch) | |
tree | 903aacb27d872bc225fb6c77bc4b0758023f9cdd | |
parent | 9865932bcdfe1b662c492dd024adf773f8e8de66 (diff) | |
download | couchdb-ae261e44a5106dd881711b90bd1528fad6db925f.tar.gz |
In the resharding API test pick the first live node
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.exs | 9 |
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 |