couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] branch master updated: In the resharding API test pick the first live node
Date Wed, 10 Apr 2019 17:45:51 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new ae261e4  In the resharding API test pick the first live node
ae261e4 is described below

commit ae261e44a5106dd881711b90bd1528fad6db925f
Author: Nick Vatamaniuc <vatamane@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


Mime
View raw message