Skip to content

Commit b85d4bb

Browse files
committed
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
1 parent 2cb7b34 commit b85d4bb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/couch/test/eunit/couchdb_os_proc_pool.erl

+1-2
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ if_no_tagged_process_found_new_must_be_spawned(_) ->
393393
% After 3rd proc returns to the pool there should
394394
% be 3 tagged idle processes
395395
?assertEqual(ok, stop_client(Client3)),
396-
wait_tagged_idle_count(3),
397-
?assertEqual(3, idle_count()).
396+
wait_tagged_idle_count(3).
398397

399398
db_tag_none_works(_) ->
400399
cfg_set("db_tag", "none"),

0 commit comments

Comments
 (0)