Skip to content

Improve flaky dbs info test#4268

Merged
nickva merged 1 commit intomainfrom
dbs-info-test-failure
Nov 18, 2022
Merged

Improve flaky dbs info test#4268
nickva merged 1 commit intomainfrom
dbs-info-test-failure

Conversation

@jaydoane
Copy link
Contributor

Overview

This test can time out with the following stack trace because ibrowse sends {error, retry_later} under certain conditions [1] which causes test_request:request/6 to sleep and retry [2], which can result in this failure:

    chttpd_dbs_info_test:79: -dbs_info_test_/0-fun-20- (should_return_500_time_out_when_time_is_not_enough_for_get_dbs_info)...*timed out*
in function timer:sleep/1 (timer.erl, line 219)
in call from test_request:request/6 (src/test_request.erl, line 106) in call from chttpd_dbs_info_test:should_return_500_time_out_when_time_is_not_enough_for_get_dbs_info/1 (test/eunit/chttpd_dbs_info_test.erl, line 157) 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

[1] https://github.com/cmullaparthi/ibrowse/blob/22d6fd6baa6e83633aa2923f41589945c1d2dc2f/src/ibrowse.erl#L409

[2]

{error, retry_later} ->
% CouchDB is busy, let’s wait a bit
timer:sleep(3000 div N),

Testing recommendations

make eunit apps=chttpd suites=chttpd_dbs_info_test tests=dbs_info_test_

Related Issues or Pull Requests

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder

Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

======================== EUnit ========================
module 'chttpd_dbs_info_test'
  chttpd dbs info tests
    chttpd_dbs_info_test:82: dbs_info_test_ (get_db_info_should_return_db_info)...[0.022 s] ok
    chttpd_dbs_info_test:83: dbs_info_test_ (get_db_info_should_return_error_when_db_not_exist)...ok
    chttpd_dbs_info_test:84: dbs_info_test_ (get_db_info_should_return_error_when_time_out)...[0.157 s] ok
    chttpd_dbs_info_test:85: dbs_info_test_ (should_return_error_for_put_dbs_info)...[0.004 s] ok
    chttpd_dbs_info_test:86: dbs_info_test_ (should_return_dbs_info_for_get_dbs_info)...[0.039 s] ok
    chttpd_dbs_info_test:87: dbs_info_test_ (should_return_nothing_when_db_not_exist_for_get_dbs_info)...[0.057 s] ok
    chttpd_dbs_info_test:88: dbs_info_test_ (should_return_500_time_out_when_time_is_not_enough_for_get_dbs_info)...[0.245 s] ok
    chttpd_dbs_info_test:89: dbs_info_test_ (should_return_db2_for_get_dbs_info_with_descending)...[0.006 s] ok
    chttpd_dbs_info_test:90: dbs_info_test_ (should_return_db1_for_get_dbs_info_with_limit_1)...[0.006 s] ok
    chttpd_dbs_info_test:91: dbs_info_test_ (should_return_db2_for_get_dbs_info_with_skip_1)...[0.006 s] ok
    chttpd_dbs_info_test:92: dbs_info_test_ (should_return_dbs_info_with_correct_start_end_key)...[0.006 s] ok
    chttpd_dbs_info_test:93: dbs_info_test_ (should_return_empty_list_with_wrong_start_end_key)...[0.020 s] ok
    chttpd_dbs_info_test:94: dbs_info_test_ (should_return_dbs_info_for_single_db)...[0.006 s] ok
    chttpd_dbs_info_test:95: dbs_info_test_ (should_return_dbs_info_for_multiple_dbs)...[0.007 s] ok
    chttpd_dbs_info_test:96: dbs_info_test_ (should_return_error_for_exceeded_keys)...[0.015 s] ok
    chttpd_dbs_info_test:97: dbs_info_test_ (should_return_error_for_missing_keys)...[0.004 s] ok
    chttpd_dbs_info_test:98: dbs_info_test_ (should_return_dbs_info_for_dbs_with_mixed_state)...[0.006 s] ok
    chttpd_dbs_info_test:99: dbs_info_test_ (should_not_allow_non_admin_access)...[0.007 s] ok
    [done in 9.228 s]
  chttpd skip limit tests
    chttpd_dbs_info_test:117: skip_limit_test_ (t_dbs_info_when_shards_db_design_doc_exist)...[0.007 s] ok
    chttpd_dbs_info_test:118: skip_limit_test_ (t_all_dbs_when_shards_db_design_doc_exist)...[0.006 s] ok
    [done in 1.320 s]
  chttpd admin only false tests
    chttpd_dbs_info_test:136: admin_only_config_false_test_ (t_dbs_info_allow_non_admin_access)...[0.012 s] ok
    chttpd_dbs_info_test:137: admin_only_config_false_test_ (t_all_dbs_allow_non_admin_access)...[0.006 s] ok
    [done in 0.965 s]
  [done in 29.921 s]
=======================================================

@jaydoane jaydoane force-pushed the dbs-info-test-failure branch 2 times, most recently from 66b3e44 to def5969 Compare November 18, 2022 16:24
This test can time out with the following stack trace because ibrowse
sends {error, retry_later} under certain conditions [1] which causes
test_request:request/6 to sleep and retry [2], which can result in
this failure:

    chttpd_dbs_info_test:79: -dbs_info_test_/0-fun-20- (should_return_500_time_out_when_time_is_not_enough_for_get_dbs_info)...*timed out*
in function timer:sleep/1 (timer.erl, line 219)
in call from test_request:request/6 (src/test_request.erl, line 106)
in call from chttpd_dbs_info_test:should_return_500_time_out_when_time_is_not_enough_for_get_dbs_info/1 (test/eunit/chttpd_dbs_info_test.erl, line 157)
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

[1] https://github.com/cmullaparthi/ibrowse/blob/22d6fd6baa6e83633aa2923f41589945c1d2dc2f/src/ibrowse.erl#L409
[2] https://github.com/apache/couchdb/blob/62d92766e8b8042c2f3627c3ac3e2365410c7912/src/couch/src/test_request.erl#L104-L106
@jaydoane jaydoane force-pushed the dbs-info-test-failure branch from def5969 to a509102 Compare November 18, 2022 17:36
@nickva
Copy link
Contributor

nickva commented Nov 18, 2022

I'll merge this, since it's ready to go, otherwise smoosh optimization PR would make it stale again.

@nickva nickva merged commit 2e0b507 into main Nov 18, 2022
@nickva nickva deleted the dbs-info-test-failure branch November 18, 2022 19:10
@jaydoane
Copy link
Contributor Author

Thanks for merging! I rebased 3 times already trying to get it done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants