You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/04/10 15:50:15 UTC

[couchdb] 01/01: In the resharding API test pick the first live node

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch fix-resharding-elixir-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d721638eb008cd6ef07671ef0c2ac3f87859d337
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed Apr 10 11:45:59 2019 -0400

    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.
---
 test/elixir/test/reshard_helpers.exs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/elixir/test/reshard_helpers.exs b/test/elixir/test/reshard_helpers.exs
index c67e690..52ce301 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