You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/02/14 00:13:02 UTC

[couchdb] 01/01: Improve replication scheduler docs tests

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

jaydoane pushed a commit to branch replicator-scheduler-docs-tests-robustification
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5cfeabe16ab8bd91cd2adfa253dca23b5a75433a
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Feb 13 16:12:28 2023 -0800

    Improve replication scheduler docs tests
    
    Increase timeout for t_scheduler_docs_total_rows.
    
    Continue to wait if "_replication_id" is still present in
    t_doc_fields_are_updated.
    
    This should improve the robustness of these failing tests:
    
      couch_replicator_scheduler_docs_tests:63: scheduler_docs_test_prefixed_db_test_ (t_scheduler_docs_total_rows)...*timed out*
    in function timer:sleep/1 (timer.erl, line 152)
    in call from test_util:wait/5 (src/test_util.erl, line 235)
    in call from couch_replicator_scheduler_docs_tests:t_scheduler_docs_total_rows/1 (test/eunit/couch_replicator_scheduler_docs_tests.erl, line 113)
    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)
      undefined
    
    couch_replicator_scheduler_docs_tests:99: with (t_doc_fields_are_updated)...*failed*
    in function couch_replicator_scheduler_docs_tests:t_doc_fields_are_updated/1 (test/eunit/couch_replicator_scheduler_docs_tests.erl, line 182)
    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:{assert,[{module,couch_replicator_scheduler_docs_tests},
             {line,182},
             {expression,"is_map_key ( << \"_replication_id\" >> , StateDoc )"},
             {expected,false},
             {value,true}]}
      output:<<"">>
---
 .../test/eunit/couch_replicator_scheduler_docs_tests.erl       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/couch_replicator/test/eunit/couch_replicator_scheduler_docs_tests.erl b/src/couch_replicator/test/eunit/couch_replicator_scheduler_docs_tests.erl
index 10a48d08e..afbf54659 100644
--- a/src/couch_replicator/test/eunit/couch_replicator_scheduler_docs_tests.erl
+++ b/src/couch_replicator/test/eunit/couch_replicator_scheduler_docs_tests.erl
@@ -60,7 +60,7 @@ scheduler_docs_test_prefixed_db_test_() ->
         fun setup_prefixed_replicator_db/0,
         fun teardown/1,
         [
-            ?TDEF_FE(t_scheduler_docs_total_rows, 10)
+            ?TDEF_FE(t_scheduler_docs_total_rows, 20)
         ]
     }.
 
@@ -117,7 +117,7 @@ t_scheduler_docs_total_rows({_Ctx, {RepDb, Source, Target}}) ->
                 {_, #{}} -> wait
             end
         end,
-        10000,
+        20000,
         1000
     ),
     Docs = maps:get(<<"docs">>, Body),
@@ -161,7 +161,11 @@ t_doc_fields_are_updated({_Ctx, {RepDb, Source, Target}}) ->
     StateDoc = test_util:wait(
         fun() ->
             case req(get, RepDocUrl) of
-                {200, #{<<"_replication_state">> := <<"completed">>} = StDoc} -> StDoc;
+                {200, #{<<"_replication_state">> := <<"completed">>} = StDoc} ->
+                    case is_map_key(<<"_replication_id">>, StDoc) of
+                        true -> wait;
+                        false -> StDoc
+                    end;
                 {_, #{}} -> wait
             end
         end,