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

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

commit c43596967caef70d2a2d24fc1ba090a395139be2
Author: Jan Lehnardt <[email protected]>
AuthorDate: Thu Feb 26 17:15:42 2026 +0100

    fix: remove flakeyness from new elixir mango tests
---
 test/elixir/test/support/mango_database.ex | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/test/elixir/test/support/mango_database.ex 
b/test/elixir/test/support/mango_database.ex
index 8007f98f7..b1e2fe60c 100644
--- a/test/elixir/test/support/mango_database.ex
+++ b/test/elixir/test/support/mango_database.ex
@@ -28,15 +28,25 @@ defmodule MangoDatabase do
   end
 
   def recreate(db, opts \\ []) do
+    delete(db)
+    wait_for_delete(db)
+    create(db, opts)
+    wait_for_db_info(db)
+  end
+
+  def wait_for_delete(db) do
     resp = Couch.get("/#{db}")
-    if resp.status_code == 200 do
-      docs = resp.body["doc_count"] + resp.body["doc_del_count"]
-      if docs > 0 do
-        delete(db)
-        create(db, opts)
-      end
-    else
-      create(db, opts)
+    if resp.status_code != 404 do
+      :timer.sleep(100)
+      wait_for_delete(db)
+    end
+  end
+
+  def wait_for_db_info(db) do
+    resp = Couch.get("/#{db}")
+    if resp.status_code == 404 do
+      :timer.sleep(100)
+      wait_for_db_info(db)
     end
   end
 

Reply via email to