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:09:42 UTC

(couchdb) branch elixir-search-test updated (9aed83d52 -> c5353d25b)

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


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

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (9aed83d52)
            \
             N -- N -- N   refs/heads/elixir-search-test (c5353d25b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:


(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 c5353d25b0346a2bfa602c42b2d8eabfef3a1c12
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:
    ```
    30 1226.4   1) test search returns all items for GET (SearchTest)
    30 1226.4      test/elixir/test/search_test.exs:67
    30 1226.4      ** (KeyError) key :status_code not found in: %HTTPotion.ErrorResponse{message: "req_timedout"}
    30 1226.4      code: assert resp.status_code == 200
    30 1226.4      stacktrace:
    30 1226.4        test/elixir/test/search_test.exs:74: (test)
    ```
---
 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" => %{}}