This is an automated email from the ASF dual-hosted git repository. jiahuili430 pushed a commit to branch fix-increase-timeout in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit b6938c5b7bbe3c0d47b7916b6270bc45dac06e23 Author: Jiahui Li <[email protected]> AuthorDate: Thu Dec 7 10:08:17 2023 -0600 Fix flaky tests by increasing timeout --- src/couch/test/eunit/couch_js_tests.erl | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/couch/test/eunit/couch_js_tests.erl b/src/couch/test/eunit/couch_js_tests.erl index 059a07e20..e335b4acb 100644 --- a/src/couch/test/eunit/couch_js_tests.erl +++ b/src/couch/test/eunit/couch_js_tests.erl @@ -13,13 +13,22 @@ -module(couch_js_tests). -include_lib("couch/include/couch_eunit.hrl"). +setup() -> + Ctx = test_util:start_couch(), + ok = meck:new(config, [passthrough]), + Ctx. + +teardown(Ctx) -> + meck:unload(), + test_util:stop_couch(Ctx). + couch_js_test_() -> { "Test couchjs", { setup, - fun test_util:start_couch/0, - fun test_util:stop_couch/1, + fun setup/0, + fun teardown/1, with([ ?TDEF(should_create_sandbox), ?TDEF(should_reset_properly), @@ -29,8 +38,8 @@ couch_js_test_() -> ?TDEF(should_replace_broken_utf16), ?TDEF(should_allow_js_string_mutations), ?TDEF(should_bump_timing_and_call_stats), - ?TDEF(should_exit_on_oom, 60000), - ?TDEF(should_exit_on_internal_error, 60000) + ?TDEF(should_exit_on_oom, 60), + ?TDEF(should_exit_on_internal_error, 60) ]) } }. @@ -276,7 +285,7 @@ should_bump_timing_and_call_stats(_) -> ?assertEqual(ReduceCalls1 + 1, sample_calls(reduce)), FilterFun = <<"function(doc, req) {return true;}">>, - UpdateFun = <<"function(doc, req) {return [null, 'something'];}">>, + UpdateFun =<<"function(doc, req) {return [null, 'something'];}">>, VduFun = <<"function(cur, old, ctx, sec) {return true;}">>, DDocId = <<"_design/ddoc1">>, DDoc = #{ @@ -344,6 +353,7 @@ should_bump_timing_and_call_stats(_) -> %% erlfmt-ignore should_exit_on_oom(_) -> + ok = meck:expect(config, get_integer, fun("couchdb", "os_process_timeout", _) -> 15000 end), Src = <<" var state = []; function(doc) { @@ -363,6 +373,7 @@ should_exit_on_internal_error(_) -> % A different way to trigger OOM which previously used to % throw an InternalError on SM. Check that we still exit on that % type of error + ok = meck:expect(config, get_integer, fun("couchdb", "os_process_timeout", _) -> 15000 end), Src = <<" function(doc) { function mkstr(l) { @@ -387,7 +398,7 @@ should_exit_on_internal_error(_) -> throw:{<<"InternalError">>, _} -> ok; % gen_server may die before replying - exit:{noproc, {gen_server,call, _}} -> + exit:{noproc, {gen_server, call, _}} -> ok; % or it may die with an epipe if it crashes while we send/recv data to it exit:{epipe, {gen_server, call, _}} ->
