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

jiahuili430 pushed a commit to branch fix-flaky-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1519f62ddcaeb9356894d0c8a667895e25ada108
Author: Jiahui Li <[email protected]>
AuthorDate: Tue Oct 14 13:03:45 2025 -0500

    Fix flaky tests by adding `Process.sleep(100)`
    
    When running elixir tests with `OTP 27` and `Elixir 1.18.4`,
    `changes_async_test.exs` became flaky. Adding `IO.inspect/2`
    fixed the test, which indicate some race conditions.
    
    Therefore, adding `Process.sleep(100)` to get the entire response
    from the `_change` endpoint.
---
 test/elixir/test/changes_async_test.exs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/elixir/test/changes_async_test.exs 
b/test/elixir/test/changes_async_test.exs
index 4850393c7..2d19c1ac1 100644
--- a/test/elixir/test/changes_async_test.exs
+++ b/test/elixir/test/changes_async_test.exs
@@ -95,6 +95,7 @@ defmodule ChangesAsyncTest do
     create_doc_bar(db_name, "bar")
 
     changes = process_response(req_id.id, &parse_event/1)
+    Process.sleep(100)
 
     assert length(changes) == 2
     assert Enum.at(changes, 0)["id"] == "foo"
@@ -149,6 +150,8 @@ defmodule ChangesAsyncTest do
     create_doc_bar(db_name, "bar")
 
     changes = process_response(req_id.id, &parse_event/1)
+    Process.sleep(100)
+
     assert length(changes) == 2
     assert Enum.at(changes, 0)["id"] == "foo"
     assert Enum.at(changes, 1)["id"] == "bar"
@@ -328,6 +331,7 @@ defmodule ChangesAsyncTest do
     create_doc(db_name, %{_id: "doc3", value: 3})
 
     changes = process_response(req_id.id, &parse_changes_line_chunk/1)
+    Process.sleep(100)
 
     changes_ids =
       changes

Reply via email to