You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/12/02 19:40:40 UTC
[couchdb] branch try-to-fix-flaky-ddoc-cache created (now 7b2606070)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch try-to-fix-flaky-ddoc-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at 7b2606070 Increase ddoc_cache test timeouts
This branch includes the following new commits:
new 7b2606070 Increase ddoc_cache test timeouts
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Increase ddoc_cache test timeouts
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch try-to-fix-flaky-ddoc-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 7b2606070441e5a09668c3c1288a983772def202
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Fri Dec 2 14:16:51 2022 -0500
Increase ddoc_cache test timeouts
To hopefully fix a flaky test I noticed:
```
module 'ddoc_cache_lru_test'
...
ddoc_cache_lru_test:97: with (check_cache_refill)...*failed*
...
in function meck_proc:wait/6 (src/meck_proc.erl, line 171)
in call from ddoc_cache_lru_test:check_cache_refill/1 (test/eunit/ddoc_cache_lru_test.erl, line 204)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
**error:timeout
```
---
src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl | 30 ++++++++++++-----------
1 file changed, 16 insertions(+), 14 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 9744a4679..2865ec392 100644
--- a/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl
+++ b/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl
@@ -20,6 +20,8 @@
-include_lib("couch/include/couch_eunit.hrl").
-include("ddoc_cache_test.hrl").
+-define(EVENT_TIMEOUT, 2000).
+
recover(<<"pause", _/binary>>) ->
receive
go -> ok
@@ -59,11 +61,11 @@ check_lru_test_() ->
fun start_couch/0,
fun stop_couch/1,
with([
- ?TDEF(check_multi_start),
- ?TDEF(check_multi_open),
- ?TDEF(check_capped_size),
- ?TDEF(check_cache_refill),
- ?TDEF(check_evict_and_exit)
+ ?TDEF(check_multi_start, 10),
+ ?TDEF(check_multi_open, 10),
+ ?TDEF(check_capped_size, 10),
+ ?TDEF(check_cache_refill, 10),
+ ?TDEF(check_evict_and_exit, 10)
])
}.
@@ -80,7 +82,7 @@ check_multi_start(_) ->
end,
lists:seq(1, 10)
),
- meck:wait(ddoc_cache_ev, event, [started, Key], 1000),
+ meck:wait(ddoc_cache_ev, event, [started, Key], ?EVENT_TIMEOUT),
lists:foreach(
fun({Pid, _Ref}) ->
?assert(is_process_alive(Pid))
@@ -114,7 +116,7 @@ check_multi_open(_) ->
Client1 = spawn_monitor(fun() ->
ddoc_cache_lru:open(Key)
end),
- meck:wait(ddoc_cache_ev, event, [started, Key], 1000),
+ meck:wait(ddoc_cache_ev, event, [started, Key], ?EVENT_TIMEOUT),
Clients =
[Client1] ++
lists:map(
@@ -162,7 +164,7 @@ check_capped_size(_) ->
fun(I) ->
DbName = list_to_binary("big_" ++ integer_to_list(I)),
ddoc_cache:open_custom(DbName, ?MODULE),
- meck:wait(I, ddoc_cache_ev, event, [started, '_'], 1000),
+ meck:wait(I, ddoc_cache_ev, event, [started, '_'], ?EVENT_TIMEOUT),
?assert(cache_size() < MaxSize * 2)
end,
lists:seq(1, 25)
@@ -171,7 +173,7 @@ check_capped_size(_) ->
fun(I) ->
DbName = list_to_binary("big_" ++ integer_to_list(I)),
ddoc_cache:open_custom(DbName, ?MODULE),
- meck:wait(I, ddoc_cache_ev, event, [started, '_'], 1000),
+ meck:wait(I, ddoc_cache_ev, event, [started, '_'], ?EVENT_TIMEOUT),
?assert(cache_size() < MaxSize * 2)
end,
lists:seq(26, 100)
@@ -193,15 +195,15 @@ check_cache_refill({DbName, _}) ->
lists:foreach(
fun(I) ->
Key = InitDDoc(I),
- meck:wait(ddoc_cache_ev, event, [started, Key], 1000)
+ meck:wait(ddoc_cache_ev, event, [started, Key], ?EVENT_TIMEOUT)
end,
lists:seq(1, 5)
),
ShardName = mem3:name(hd(mem3:shards(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),
+ meck:wait(ddoc_cache_ev, event, [evicted, DbName], ?EVENT_TIMEOUT),
+ meck:wait(10, ddoc_cache_ev, event, [removed, '_'], ?EVENT_TIMEOUT),
test_util:wait(
fun() ->
case ets:info(?CACHE, size) of
@@ -214,7 +216,7 @@ check_cache_refill({DbName, _}) ->
lists:foreach(
fun(I) ->
Key = InitDDoc(I),
- meck:wait(ddoc_cache_ev, event, [started, Key], 1000)
+ meck:wait(ddoc_cache_ev, event, [started, Key], ?EVENT_TIMEOUT)
end,
lists:seq(6, 10)
).
@@ -238,7 +240,7 @@ check_evict_and_exit(_) ->
% Resume the LRU and ensure that it doesn't die
erlang:resume_process(whereis(ddoc_cache_lru)),
- meck:wait(ddoc_cache_ev, event, [evicted, <<"dbname">>], 1000),
+ meck:wait(ddoc_cache_ev, event, [evicted, <<"dbname">>], ?EVENT_TIMEOUT),
% Make sure it can handle another message
OtherKey = {ddoc_cache_entry_custom, {<<"otherdb">>, ?MODULE}},