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 2020/05/13 20:40:53 UTC
[couchdb] branch prototype/fdb-layer updated: Fix a few flaky tests
in fabric2_db
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
new f0040c7 Fix a few flaky tests in fabric2_db
f0040c7 is described below
commit f0040c79d5437aefa60791f64abb9eb8cd2a2e54
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed May 13 16:23:42 2020 -0400
Fix a few flaky tests in fabric2_db
Add some longer timeouts and fix a race condition in db cleanup tests
(Thanks to @jdoane for the patch)
---
src/fabric/test/fabric2_db_crud_tests.erl | 25 +++++++++++++++----------
src/fabric/test/fabric2_dir_prefix_tests.erl | 4 ++--
src/fabric/test/fabric2_index_tests.erl | 6 +++---
src/fabric/test/fabric2_tx_options_tests.erl | 4 ++--
4 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/fabric/test/fabric2_db_crud_tests.erl b/src/fabric/test/fabric2_db_crud_tests.erl
index b1e15aa..b529935 100644
--- a/src/fabric/test/fabric2_db_crud_tests.erl
+++ b/src/fabric/test/fabric2_db_crud_tests.erl
@@ -40,8 +40,8 @@ crud_test_() ->
?TDEF_FE(recreate_db),
?TDEF_FE(undelete_db),
?TDEF_FE(remove_deleted_db),
- ?TDEF_FE(scheduled_remove_deleted_db),
- ?TDEF_FE(scheduled_remove_deleted_dbs),
+ ?TDEF_FE(scheduled_remove_deleted_db, 15),
+ ?TDEF_FE(scheduled_remove_deleted_dbs, 15),
?TDEF_FE(old_db_handle),
?TDEF_FE(list_dbs),
?TDEF_FE(list_dbs_user_fun),
@@ -95,9 +95,7 @@ setup_all() ->
teardown_all(Ctx) ->
- meck:unload(erlfdb),
- meck:unload(config),
- meck:unload(fabric2_db_expiration),
+ meck:unload(),
test_util:stop_couch(Ctx).
@@ -251,11 +249,17 @@ scheduled_remove_deleted_db(_) ->
?assertEqual(ok, fabric2_db:delete(DbName, [])),
?assertEqual(false, ets:member(fabric2_server, DbName)),
- meck:wait(fabric2_db_expiration, process_expirations, '_', 5000),
+ meck:reset(fabric2_db_expiration),
+ meck:wait(fabric2_db_expiration, process_expirations, '_', 7000),
- {ok, Infos} = fabric2_db:list_deleted_dbs_info(),
- DeletedDbs = [proplists:get_value(db_name, Info) || Info <- Infos],
- ?assert(not lists:member(DbName, DeletedDbs)).
+ ?assertEqual(ok, test_util:wait(fun() ->
+ {ok, Infos} = fabric2_db:list_deleted_dbs_info(),
+ DeletedDbs = [proplists:get_value(db_name, Info) || Info <- Infos],
+ case lists:member(DbName, DeletedDbs) of
+ true -> wait;
+ false -> ok
+ end
+ end)).
scheduled_remove_deleted_dbs(_) ->
@@ -263,7 +267,8 @@ scheduled_remove_deleted_dbs(_) ->
ok = config:set("couchdb", "db_expiration_batch", "2", false),
ok = config:set("couchdb", "enable_database_recovery", "true", false),
DbNameList = [create_and_delete_db() || _I <- lists:seq(1, 5)],
- meck:wait(fabric2_db_expiration, process_expirations, '_', 5000),
+ meck:reset(fabric2_db_expiration),
+ meck:wait(fabric2_db_expiration, process_expirations, '_', 7000),
{ok, Infos} = fabric2_db:list_deleted_dbs_info(),
DeletedDbs = [proplists:get_value(db_name, Info) || Info <- Infos],
diff --git a/src/fabric/test/fabric2_dir_prefix_tests.erl b/src/fabric/test/fabric2_dir_prefix_tests.erl
index 75d68a8..2943d65 100644
--- a/src/fabric/test/fabric2_dir_prefix_tests.erl
+++ b/src/fabric/test/fabric2_dir_prefix_tests.erl
@@ -33,8 +33,8 @@ dir_prefix_test_() ->
test_util:stop_couch(Ctx)
end,
with([
- ?TDEF(default_prefix),
- ?TDEF(custom_prefix)
+ ?TDEF(default_prefix, 15),
+ ?TDEF(custom_prefix, 15)
])
}.
diff --git a/src/fabric/test/fabric2_index_tests.erl b/src/fabric/test/fabric2_index_tests.erl
index fa3a14d..8a4acb7 100644
--- a/src/fabric/test/fabric2_index_tests.erl
+++ b/src/fabric/test/fabric2_index_tests.erl
@@ -50,8 +50,8 @@ index_process_cleanup_test_() ->
fun setup/0,
fun cleanup/1,
[
- ?TDEF_FE(updater_processes_start),
- ?TDEF_FE(updater_processes_stop),
+ ?TDEF_FE(updater_processes_start, 15),
+ ?TDEF_FE(updater_processes_stop, 15),
?TDEF_FE(indexing_can_be_disabled),
?TDEF_FE(handle_indexer_blowing_up)
]
@@ -206,7 +206,7 @@ updater_processes_stop(#{}) ->
lists:foreach(fun(Ref) ->
receive
{'DOWN', Ref, _, _, _} -> ok
- after 3000 ->
+ after 5000 ->
?assert(false)
end
end, Refs).
diff --git a/src/fabric/test/fabric2_tx_options_tests.erl b/src/fabric/test/fabric2_tx_options_tests.erl
index 34cb6e1..b93cc3d 100644
--- a/src/fabric/test/fabric2_tx_options_tests.erl
+++ b/src/fabric/test/fabric2_tx_options_tests.erl
@@ -42,8 +42,8 @@ fdb_tx_options_test_() ->
test_util:stop_couch(Ctx)
end,
with([
- ?TDEF(options_take_effect),
- ?TDEF(can_configure_options_at_runtime)
+ ?TDEF(options_take_effect, 15),
+ ?TDEF(can_configure_options_at_runtime, 15)
])
}.