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:27:27 UTC

[couchdb] branch fix-some-flaky-tests updated (9ef5610 -> 1d8c809)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch fix-some-flaky-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 9ef5610  Fix a few flaky tests in fabric2_db
     new 1d8c809  Fix a few flaky tests in fabric2_db

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (9ef5610)
            \
             N -- N -- N   refs/heads/fix-some-flaky-tests (1d8c809)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 src/fabric/test/fabric2_tx_options_tests.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[couchdb] 01/01: Fix a few flaky tests in fabric2_db

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch fix-some-flaky-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1d8c80942c99013d7ed7d9e1bac56294a8e86d30
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)
         ])
     }.