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

jaydoane 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 b85d4bb14 Remove redundant and racy assertion
b85d4bb14 is described below

commit b85d4bb143550ad7227152c3f5e2fc6a6cf98f96
Author: Jay Doane <[email protected]>
AuthorDate: Sat Aug 17 14:57:06 2024 -0700

    Remove redundant and racy assertion
    
    The `wait_tagged_idle_count/1` function already performs an assertion
    [1] on the idle count, so the final `?assertEqual` is both redundant,
    and also apparently racy based on this test failure:
    
    ```
    ::in function 
couchdb_os_proc_pool:if_no_tagged_process_found_new_must_be_spawned/1 
(test/eunit/couchdb_os_proc_pool.erl, line 397)
    in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
    in call from eunit_proc:run_test/1 (eunit_proc.erl, line 543)
    in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 368)
    in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 526)
    in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 468)
    in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 358)
    in call from eunit_proc:run_group/2 (eunit_proc.erl, line 582)
    **error:{assertEqual,[{module,couchdb_os_proc_pool},
                  {line,397},
                  {expression,"idle_count ( )"},
                  {expected,3},
                  {value,2}]}
    ```
    It seems that the tagged idle count can also drop from 3 to 2 between
    the first and second assertion.
    
    [1] 
https://github.com/apache/couchdb/blob/main/src/couch/test/eunit/couchdb_os_proc_pool.erl#L654
---
 src/couch/test/eunit/couchdb_os_proc_pool.erl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/couch/test/eunit/couchdb_os_proc_pool.erl 
b/src/couch/test/eunit/couchdb_os_proc_pool.erl
index b15c90314..1a8479497 100644
--- a/src/couch/test/eunit/couchdb_os_proc_pool.erl
+++ b/src/couch/test/eunit/couchdb_os_proc_pool.erl
@@ -393,8 +393,7 @@ if_no_tagged_process_found_new_must_be_spawned(_) ->
     % After 3rd proc returns to the pool there should
     % be 3 tagged idle processes
     ?assertEqual(ok, stop_client(Client3)),
-    wait_tagged_idle_count(3),
-    ?assertEqual(3, idle_count()).
+    wait_tagged_idle_count(3).
 
 db_tag_none_works(_) ->
     cfg_set("db_tag", "none"),

Reply via email to