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

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


The following commit(s) were added to refs/heads/main by this push:
     new 6e9834564 Fix flaky elixir users_db_tests
6e9834564 is described below

commit 6e9834564f648453888c72214373117d5bba29e9
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Sat Mar 4 01:43:07 2023 -0500

    Fix flaky elixir users_db_tests
    
    This fails more often on MacOS CI workers [1] but it seems to be a general
    flaky test as the users auth ddoc is not guaranteed to be inserted
    synchronously.
    
    [1] https://github.com/apache/couchdb/issues/4397#issue-1551336429
---
 test/elixir/test/users_db_test.exs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/elixir/test/users_db_test.exs 
b/test/elixir/test/users_db_test.exs
index 0b7ee8199..a13c1a4f3 100644
--- a/test/elixir/test/users_db_test.exs
+++ b/test/elixir/test/users_db_test.exs
@@ -104,8 +104,12 @@ defmodule UsersDbTest do
   test "users db", context do
     db_name = context[:db_name]
     # test that the users db is born with the auth ddoc
-    ddoc = Couch.get("/#{@users_db_name}/_design/_auth")
-    assert ddoc.body["validate_doc_update"] != nil
+    get_ddoc = fn ->
+         ddoc = Couch.get("/#{@users_db_name}/_design/_auth")
+         ddoc.body["validate_doc_update"]
+    end
+    retry_until(fn -> get_ddoc.() != nil end)
+    assert get_ddoc.() != nil
 
     jchris_user_doc =
       prepare_user_doc([

Reply via email to