summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holley <willholley@apache.org>2019-12-16 10:30:16 +0000
committerGitHub <noreply@github.com>2019-12-16 10:30:16 +0000
commit789ffbc3ef0f05a87539df84e4b23acbbc3215b1 (patch)
tree9795420a8e5e076adc94b644cecd6be53c1a9cf7
parent18b97f7c44d8143ea6231f2547ae20d480becdb5 (diff)
parent5c0cf2e305a34cd30c04f09b18c6e78462aa96c1 (diff)
downloadcouchdb-789ffbc3ef0f05a87539df84e4b23acbbc3215b1.tar.gz
Merge pull request #2357 from apache/mango_test_fixes
When creating a Mango index in the Elixir tests, we need to block until the database reports the index as available. This workaround was present in the python Mango tests but did not get ported to Elixir when the partitioned Mango tests were added.
-rw-r--r--test/elixir/test/partition_mango_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/elixir/test/partition_mango_test.exs b/test/elixir/test/partition_mango_test.exs
index 3fd38d52b..992999fb9 100644
--- a/test/elixir/test/partition_mango_test.exs
+++ b/test/elixir/test/partition_mango_test.exs
@@ -17,6 +17,26 @@ defmodule PartitionMangoTest do
assert resp.status_code == 200
assert resp.body["result"] == "created"
+ assert resp.body["id"] != nil
+ assert resp.body["name"] != nil
+
+ # wait until the database reports the index as available
+ retry_until(fn ->
+ get_index(db_name, resp.body["id"], resp.body["name"]) != nil
+ end)
+ end
+
+ def list_indexes(db_name) do
+ resp = Couch.get("/#{db_name}/_index")
+ assert resp.status_code == 200
+ resp.body["indexes"]
+ end
+
+ def get_index(db_name, ddocid, name) do
+ indexes = list_indexes(db_name)
+ Enum.find(indexes, fn(index) ->
+ match?(%{"ddoc" => ^ddocid, "name" => ^name}, index)
+ end)
end
def get_partitions(resp) do