-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce log_helper, and use it in config_parser_SUITE #4239
Conversation
Small tests used logger_ct_backend, but it was meant for big tests: - The default formatter was used in small tests (no app.config), requiring regexp matching. - RPC was used, but it was not needed. Advantages of the new helper: - Concise and simple eunit-like assertions - Does not consume unwanted received messages thanks to pattern matching in 'receive' - Easier set-up and tear-down with one handler per testcase.
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / aac3dc0 small_tests_25 / small_tests / aac3dc0 small_tests_26 / small_tests / aac3dc0 small_tests_26_arm64 / small_tests / aac3dc0 ldap_mnesia_25 / ldap_mnesia / aac3dc0 ldap_mnesia_26 / ldap_mnesia / aac3dc0 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / aac3dc0 dynamic_domains_mysql_redis_26 / mysql_redis / aac3dc0 pgsql_cets_26 / pgsql_cets / aac3dc0 dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / aac3dc0 internal_mnesia_26 / internal_mnesia / aac3dc0 pgsql_mnesia_25 / pgsql_mnesia / aac3dc0 pgsql_mnesia_26 / pgsql_mnesia / aac3dc0 dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / aac3dc0 mysql_redis_26 / mysql_redis / aac3dc0 mssql_mnesia_26 / odbc_mssql_mnesia / aac3dc0 |
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / af88267 small_tests_25 / small_tests / af88267 small_tests_26 / small_tests / af88267 small_tests_26_arm64 / small_tests / af88267 ldap_mnesia_25 / ldap_mnesia / af88267 ldap_mnesia_26 / ldap_mnesia / af88267 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / af88267 dynamic_domains_mysql_redis_26 / mysql_redis / af88267 pgsql_cets_26 / pgsql_cets / af88267 dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / af88267 pgsql_mnesia_25 / pgsql_mnesia / af88267 internal_mnesia_26 / internal_mnesia / af88267 mysql_redis_26 / mysql_redis / af88267 sm_SUITE:ping_timeout{error,
{{badmatch,
[{xmlel,<<"iq">>,
[{<<"type">>,<<"error">>},
{<<"to">>,<<"localhost">>},
{<<"from">>,
<<"alice_ping_timeout_3428@localhost/escalus-default-resource">>},
{<<"id">>,<<"a9d5cb126252d9cc">>}],
[{xmlel,<<"ping">>,[{<<"xmlns">>,<<"urn:xmpp:ping">>}],[]},
{xmlel,<<"error">>,
[{<<"code">>,<<"503">>},{<<"type">>,<<"cancel">>}],
[{xmlel,<<"service-unavailable">>,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}],
[]},
{xmlel,<<"text">>,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}],
[{xmlcdata,<<"Route offline">>}]}]}]},
{xmlel,<<"iq">>,
[{<<"type">>,<<"error">>},
{<<"to">>,<<"localhost">>},
{<<"from">>,
<<"alice_ping_timeout_3428@localhost/escalus-default-resource">>},
{<<"id">>,<<"e7b54b2b6ed71f2a">>}],
[{xmlel,<<"ping">>,[{<<"xmlns">>,<<"urn:xmpp:ping">>}],[]},
{xmlel,<<"error">>,
[{<<"code">>,<<"503">>},{<<"type">>,<<"cancel">>}],
[{xmlel,<<"service-unavailable">>,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}],
[]},
{xmlel,<<"text">>,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}],
[{xmlcdata,<<"Route offline">>}]}]}]}]},
[{sm_SUITE,ping_timeout,1,
[{file,"/home/ci... pgsql_mnesia_26 / pgsql_mnesia / af88267 mssql_mnesia_26 / odbc_mssql_mnesia / af88267 graphql_muc_light_SUITE:domain_admin:domain_admin_muc_light:admin_create_room_with_unprepped_id{error,
{{badmatch,null},
[{graphql_muc_light_SUITE,admin_create_room_with_unprepped_id,1,
[{file,
"/home/circleci/project/big_tests/tests/graphql_muc_light_SUITE.erl"},
{line,1155}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1302}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1234}]}]}} pep_SUITE:pep_tests:disco_sm_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"alice_disco_sm_items_test_2932@localhost/res1">>,
escalus_tcp,<0.76641.0>,
[{event_manager,<0.76575.0>},
{server,<<"localhost">>},
{username,<<"alicE_disco_sm_items_test_2932">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76575.0>},
{server,<<"localhost">>},
{username,<<"alicE_disco_sm_items_test_2932">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_disco_sm_items_test_2932">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_disco_sm_items_test_2932">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"3b4d6f3fd99eb171">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,424}]},
{pep_SUITE,'-disco_sm_items_test/1-fun-2-',2,
... pep_SUITE:pep_tests:publish_options_fail_wrong_value_story{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_publish_options_fail_wrong_value_story_2940@localhost/res1">>,
escalus_tcp,<0.76648.0>,
[{event_manager,<0.76615.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_fail_wrong_value_story_2940">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76615.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_fail_wrong_value_story_2940">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_publish_options_fail_wrong_value_story_2940">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,
<<"alicE_publish_options_fail_wrong_value_story_2940">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"07706dd3f053a8fb">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_re... pep_SUITE:pep_tests:publish_options_fail_wrong_form{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_publish_options_fail_wrong_form_2938@localhost/res1">>,
escalus_tcp,<0.76642.0>,
[{event_manager,<0.76605.0>},
{server,<<"localhost">>},
{username,<<"alicE_publish_options_fail_wrong_form_2938">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76605.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_fail_wrong_form_2938">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_publish_options_fail_wrong_form_2938">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_publish_options_fail_wrong_form_2938">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"9afbd61abe0c984c">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pep_SUITE,'-publish_options_fail_wrong_form/1-fun-0-',1,
[{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
{line,313}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/... pep_SUITE:pep_tests:send_caps_after_login_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_caps_after_login_test_2934@localhost/res1">>,
escalus_tcp,<0.76650.0>,
[{event_manager,<0.76585.0>},
{server,<<"localhost">>},
{username,<<"alicE_send_caps_after_login_test_2934">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76585.0>},
{server,<<"localhost">>},
{username,<<"alicE_send_caps_after_login_test_2934">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_send_caps_after_login_test_2934">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_send_caps_after_login_test_2934">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"b445bdb62654135a">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,424}]},
{pep_S... pep_SUITE:pep_tests:publish_options_success_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_publish_options_success_test_2933@localhost/res1">>,
escalus_tcp,<0.76649.0>,
[{event_manager,<0.76582.0>},
{server,<<"localhost">>},
{username,<<"alicE_publish_options_success_test_2933">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76582.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_success_test_2933">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_publish_options_success_test_2933">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_publish_options_success_test_2933">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"f7f0ec253e299d0c">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
... pep_SUITE:pep_tests:publish_options_fail_unknown_option_story{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_publish_options_fail_unknown_option_story_2935@localhost/res1">>,
escalus_tcp,<0.76647.0>,
[{event_manager,<0.76590.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_fail_unknown_option_story_2935">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76590.0>},
{server,<<"localhost">>},
{username,
<<"alicE_publish_options_fail_unknown_option_story_2935">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_publish_options_fail_unknown_option_story_2935">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,
<<"alicE_publish_options_fail_unknown_option_story_2935">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"adacffd8868d4344">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pep_SUITE,'-publish_options_fail_unknown_option_story/1-fun-0-',1,
[{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
{line,2... pep_SUITE:pep_tests:authorize_access_model{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"alice_authorize_access_model_2945@localhost/res1">>,
escalus_tcp,<0.76663.0>,
[{event_manager,<0.76640.0>},
{server,<<"localhost">>},
{username,<<"alicE_authorize_access_model_2945">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76640.0>},
{server,<<"localhost">>},
{username,<<"alicE_authorize_access_model_2945">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_authorize_access_model_2945">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_authorize_access_model_2945">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"7894f17cbbf5e402">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,424}]},
{pep_SUITE,'-authorize_access_model/1... pep_SUITE:pep_tests:delayed_receive{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"alice_delayed_receive_2931@localhost/res1">>,
escalus_tcp,<0.76651.0>,
[{event_manager,<0.76570.0>},
{server,<<"localhost">>},
{username,<<"alicE_delayed_receive_2931">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.76570.0>},
{server,<<"localhost">>},
{username,<<"alicE_delayed_receive_2931">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_delayed_receive_2931">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"alicE_delayed_receive_2931">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"889165ee26883c72">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,433}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,424}]},
{pep_SUITE,delayed_receive_story,3,
[{file,"/home/circleci/projec... pep_SUITE:pep_tests:publish_and_notify_test{error,{{assertion_failed,assert_many,false,[is_roster_set],[],[]},
[{escalus_new_assert,assert_true,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{escalus_story,'-make_all_clients_friends/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,108}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
{escalus_utils,distinct_pairs,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,60}]},
{escalus_story,make_all_clients_friends,1,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,106}]}]}} pep_SUITE:pep_tests:h_ok_after_notify_test{error,{{assertion_failed,assert_many,false,[is_roster_set],[],[]},
[{escalus_new_assert,assert_true,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{escalus_story,'-make_all_clients_friends/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,108}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
{escalus_utils,distinct_pairs,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,60}]},
{escalus_story,make_all_clients_friends,1,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,106}]}]}} pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,{{assertion_failed,assert_many,false,
[is_roster_set,is_presence,is_presence],
[],[]},
[{escalus_new_assert,assert_true,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{escalus_story,'-make_all_clients_friends/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,114}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
{escalus_utils,'-each_with_index/3-fun-0-',3,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,87}]},
{lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
{escalus_utils,distinct_pairs,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_utils.erl"},
{line,60}]},
{escalus_story,make_all_clients_friends,1,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,106}]}]}} pep_SUITE:pep_tests:delayed_receive_with_sm{error,
{{assertion_failed,assert_many,false,
[is_message,is_iq,is_presence,is_presence,is_sm_ack_request,
is_sm_ack_request,is_sm_ack_request,is_sm_ack_request],
[{xmlel,<<"iq">>,
[{<<"from">>,<<"bob_delayed_receive_with_sm_2942@localhost">>},
{<<"to">>,
<<"bob_delayed_receive_with_sm_2942@localhost/res1">>},
{<<"id">>,<<"push9b7a69b68b700d78">>},
{<<"type">>,<<"set">>}],
[{xmlel,<<"query">>,
[{<<"xmlns">>,<<"jabber:iq:roster">>}],
[{xmlel,<<"item">>,
[{<<"jid">>,
<<"alice_delayed_receive_with_sm_2942@localhost">>},
{<<"subscription">>,<<"to">>}],
[]}]}]},
{xmlel,<<"r">>,[{<<"xmlns">>,<<"urn:xmpp:sm:3">>}],[]},
{xmlel,<<"presence">>,
[{<<"from">>,<<"alice_delayed_receive_with_sm_2942@localhost">>},
{<<"to">>,
<<"bob_delayed_receive_with_sm_2942@localhost/res1">>},
{<<"type">>,<<"subscribed">>}],
[]},
{xmlel,<<"r">>,[{<<"xmlns">>,<<"urn:xmpp:sm:3">>}],[]},
{xmlel,<<"presence">>,
[{<<"from">>,
<<"alice_delayed_receive_with_sm_2942@localhost/res1">>},
{<<"to">>,
<<"bob_delayed_receive_with_sm_2942@localhost/res1">>}],
[]},
{xmlel,<<"r">>,[{<<"xmlns">>,<<"urn:xmpp:sm:3">>}],[]}],
" <iq from='bob_delayed_receive_with_sm_2942@localhost' to='bob_delayed_receive_with_sm_2942@localhost/res1' id='push9b7a69b68b700d78' type='set... mysql_redis_26 / mysql_redis / af88267 mssql_mnesia_26 / odbc_mssql_mnesia / af88267 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4239 +/- ##
==========================================
+ Coverage 84.19% 84.39% +0.20%
==========================================
Files 552 552
Lines 33538 33538
==========================================
+ Hits 28238 28306 +68
+ Misses 5300 5232 -68 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔥
logger_ct_backend:stop(Node), | ||
|
||
FilterFun = fun(_, Msg) -> | ||
re:run(Msg, "test") /= nomatch orelse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just getting rid of these regexes and actually doing struct matching is such a great win!
-compile([export_all, nowarn_export_all]). | ||
|
||
%% Call in init_per_testcase | ||
set_up() -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just note, if doing it in parallel, it would stop working because see:
https://github.com/arcusfelis/logger_debug_h/blob/main/src/logger_debug_h.erl#L23
currently it is sequential in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did indeed manage to get a fail after 1000 retries of many parallel tests. I will investigate the reason, if I have time. It only happens if I do remove handlers.
Sequential is good enough for now, but we could investigate if it's a bug. If it is the case, we could just convert this module into a simple gen_server
(like logger_ct_backend
), or use an ETS table. There would be only one handler, and no issue.
Have you logged the issue at OTP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI: I confirm that adding/removal of handlers is done in asynchronous processes.
An ETS-based solution with a single handler is still very short, and works as expected. I will do this in a new PR.
logger:remove_handler(handler_id()). | ||
|
||
%% Logger callback | ||
log(Event, #{receiver := Receiver}) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of that tool. It looks quite complicated. I'd stick with the simple solution for now.
The main motivation for this PR is that using
logger_ct_backend
in small tests is difficult.I also tried the new helper in the upcoming PR for
mongoose_instrument_log
, and it simplified my tests significantly.Small tests used
logger_ct_backend
, but it was meant for big tests:app.config
), requiring regexp matching.Advantages of the new helper:
receive
I didn't move
logger_ct_backend
away fromtest/common
- it does no harm apart from being more difficult to use.