diff options
author | Jay Doane <jaydoane@apache.org> | 2022-10-05 22:53:02 -0700 |
---|---|---|
committer | Jay Doane <jay.s.doane@gmail.com> | 2022-10-11 12:57:54 -0700 |
commit | 4583c69b419b3532ffabdd27c504a4ee02bcfda7 (patch) | |
tree | b1406e3811dd56fd73e69fbf059f23e89cdcd585 | |
parent | a2398084b3847003c911ffdfe70471b47519ba13 (diff) | |
download | couchdb-4583c69b419b3532ffabdd27c504a4ee02bcfda7.tar.gz |
Wait for race in ddoc cache lru test
This failure seems to occur from a race between meck:wait and the test
runner:
ddoc_cache_tutil:109: -with/1-fun-1- (check_cache_refill)...*failed*
in function ddoc_cache_lru_test:check_cache_refill/1 (test/eunit/ddoc_cache_lru_test.erl, line 205)
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 531)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)
in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 514)
in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 456)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 346)
in call from eunit_proc:run_group/2 (eunit_proc.erl, line 570)
**error:{assertEqual,[{module,ddoc_cache_lru_test},
{line,205},
{expression,"ets : info ( ? CACHE , size )"},
{expected,0},
{value,1}]}
output:<<"">>
This changes the test to wait until the table is explicitly empty
before proceeding.
-rw-r--r-- | src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl b/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl index 162cdb549..9744a4679 100644 --- a/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl +++ b/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl @@ -202,7 +202,14 @@ check_cache_refill({DbName, _}) -> {ok, _} = ddoc_cache_lru:handle_db_event(ShardName, deleted, foo), meck:wait(ddoc_cache_ev, event, [evicted, DbName], 1000), meck:wait(10, ddoc_cache_ev, event, [removed, '_'], 1000), - ?assertEqual(0, ets:info(?CACHE, size)), + test_util:wait( + fun() -> + case ets:info(?CACHE, size) of + 0 -> ok; + _ -> wait + end + end + ), lists:foreach( fun(I) -> |