You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2025/01/10 19:08:50 UTC

(couchdb) branch elixir-search-test created (now 9aed83d52)

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

jiahuili430 pushed a change to branch elixir-search-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at 9aed83d52 Fix unstable tests by adding 'retry_until()'

This branch includes the following new commits:

     new 9aed83d52 Fix unstable tests by adding 'retry_until()'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(couchdb) 01/01: Fix unstable tests by adding 'retry_until()'

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9aed83d52a023676996b65d81aa663d5f4aaed3b
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Fri Jan 10 13:05:23 2025 -0600

    Fix unstable tests by adding 'retry_until()'
    
    Add `retry_until()` to avoid request timeout error in search_test.exs.
    
    Error logs:
    ```
    ```
---
 test/elixir/test/search_test.exs | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/test/elixir/test/search_test.exs b/test/elixir/test/search_test.exs
index edf08f30d..9cd7623a0 100644
--- a/test/elixir/test/search_test.exs
+++ b/test/elixir/test/search_test.exs
@@ -71,7 +71,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.get(url, query: %{q: "*:*", include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "carrot", "date"])
   end
@@ -84,7 +84,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.get(url, query: %{q: "*:*", drilldown: :jiffy.encode(["place", "kitchen"]), include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "carrot"])
   end
@@ -97,7 +97,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.get(url, query: %{q: "*:*", drilldown: :jiffy.encode(["state", "new", "unknown"]), include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "date"])
   end
@@ -110,7 +110,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.get(url, query: %{q: "*:*", drilldown: :jiffy.encode([["state", "old"], ["item", "apple"]]), include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == []
   end
@@ -123,7 +123,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits?q=*:*&drilldown=[\"state\",\"old\"]&drilldown=[\"item\",\"apple\"]&include_docs=true"
     resp = Couch.get(url)
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == []
   end
@@ -137,7 +137,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{q: "*:*", include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "carrot", "date"])
   end
@@ -150,7 +150,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{query: "*:*", drilldown: ["place", "kitchen"], include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "carrot"])
   end
@@ -163,7 +163,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{query: "*:*", drilldown: ["state", "new", "unknown"], include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == Enum.sort(["apple", "banana", "date"])
   end
@@ -176,7 +176,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{q: "*:*", drilldown: [["state", "old"], ["item", "apple"]], include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == []
   end
@@ -189,7 +189,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{q: "*:*", drilldown: [["place", "kitchen"], ["state", "new"], ["item", "apple"]], include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == ["apple"]
   end
@@ -202,7 +202,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: %{q: "*:*", drilldown: [["state", "old", "new"], ["item", "apple"]], include_docs: true})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == ["apple"]
   end
@@ -215,7 +215,7 @@ defmodule SearchTest do
 
     url = "/#{db_name}/_design/inventory/_search/fruits"
     resp = Couch.post(url, body: "{\"include_docs\": true, \"q\": \"*:*\", \"drilldown\": [\"state\", \"old\"], \"drilldown\": [\"item\", \"apple\"]}")
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
     ids = get_items(resp)
     assert Enum.sort(ids) == ["apple"]
   end
@@ -240,7 +240,7 @@ defmodule SearchTest do
     url = "/#{db_name}/_design/inventory/_search/fruits"
     counts = ["place"]
     resp = Couch.get(url, query: %{q: "*:*", limit: 0, counts: :jiffy.encode(counts)})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
 
     %{:body => %{"counts" => counts}} = resp
     assert counts == %{"place" => %{"kitchen" => 3, "lobby" => 1}}
@@ -255,7 +255,7 @@ defmodule SearchTest do
     url = "/#{db_name}/_design/inventory/_search/fruits"
     counts = ["place"]
     resp = Couch.get(url, query: %{q: "item:tomato", limit: 0, counts: :jiffy.encode(counts)})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
 
     %{:body => %{"counts" => counts}} = resp
     assert counts == %{"place" => %{}}
@@ -270,7 +270,7 @@ defmodule SearchTest do
     url = "/#{db_name}/_design/inventory/_search/fruits"
     ranges = %{"price" => %{"cheap" => "[0 TO 0.99]", "expensive" => "[1.00 TO Infinity]"}}
     resp = Couch.get(url, query: %{q: "*:*", limit: 0, ranges: :jiffy.encode(ranges)})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
 
     %{:body => %{"ranges" => ranges}} = resp
     assert ranges == %{"price" => %{"cheap" => 2, "expensive" => 2}}
@@ -285,7 +285,7 @@ defmodule SearchTest do
     url = "/#{db_name}/_design/inventory/_search/fruits"
     ranges = %{"price" => %{}}
     resp = Couch.get(url, query: %{q: "*:*", limit: 0, ranges: :jiffy.encode(ranges)})
-    assert resp.status_code == 200
+    retry_until(fn -> resp.status_code == 200 end)
 
     %{:body => %{"ranges" => ranges}} = resp
     assert ranges == %{"price" => %{}}