Skip to content
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

Improve error handling in account API #3824

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

jacekwegr
Copy link
Contributor

@jacekwegr jacekwegr commented Oct 24, 2022

This PR improves error handling for common corner cases in account API

@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 24, 2022

Codecov Report

Base: 83.03% // Head: 83.05% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (b616c0f) compared to base (0704606).
Patch coverage: 91.48% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3824      +/-   ##
==========================================
+ Coverage   83.03%   83.05%   +0.01%     
==========================================
  Files         529      529              
  Lines       33889    33909      +20     
==========================================
+ Hits        28141    28164      +23     
+ Misses       5748     5745       -3     
Impacted Files Coverage Δ
src/ejabberd_admin.erl 65.62% <ø> (ø)
src/auth/ejabberd_auth.erl 83.75% <78.57%> (-1.59%) ⬇️
src/mongoose_account_api.erl 98.78% <95.00%> (+0.15%) ⬆️
src/ejabberd_ctl.erl 54.27% <100.00%> (+0.13%) ⬆️
.../admin/mongoose_graphql_account_admin_mutation.erl 94.73% <100.00%> (ø)
...hql/admin/mongoose_graphql_account_admin_query.erl 100.00% <100.00%> (ø)
...rc/mongoose_admin_api/mongoose_admin_api_users.erl 100.00% <100.00%> (ø)
src/elasticsearch/mongoose_elasticsearch.erl 76.92% <0.00%> (-7.70%) ⬇️
src/auth/ejabberd_auth_anonymous.erl 67.18% <0.00%> (-3.13%) ⬇️
src/auth/mongoose_gen_auth.erl 85.36% <0.00%> (-2.44%) ⬇️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 1c27e62 to 7c6687b Compare October 28, 2022 10:41
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 7c6687b to 3291adb Compare October 28, 2022 11:39
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 3291adb to 2b583d9 Compare October 28, 2022 13:14
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 2b583d9 to 9667a19 Compare October 28, 2022 16:07
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 9667a19 to 5f372cc Compare November 2, 2022 08:35
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 5f372cc to d25f84a Compare November 2, 2022 14:16
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr marked this pull request as ready for review November 2, 2022 15:15
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

The code looks good in general. I added a few comments.
Also, it looks like the legacy commands are broken, e.g.

_build/mim1/rel/mongooseim/bin/mongooseimctl registered_users baddomain

This used to return an empty list, but now crashes. Maybe it could display an error message?

big_tests/tests/graphql_account_SUITE.erl Outdated Show resolved Hide resolved
src/auth/ejabberd_auth.erl Outdated Show resolved Hide resolved
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from a050f10 to 4e1a067 Compare November 8, 2022 07:01
@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr force-pushed the improve-error-handling-in-account-api branch from 4e1a067 to b616c0f Compare November 8, 2022 07:46
@mongoose-im
Copy link
Collaborator

mongoose-im commented Nov 8, 2022

small_tests_24 / small_tests / b616c0f
Reports root / small


small_tests_25 / small_tests / b616c0f
Reports root / small


ldap_mnesia_24 / ldap_mnesia / b616c0f
Reports root/ big
OK: 2103 / Failed: 0 / User-skipped: 783 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / b616c0f
Reports root/ big
OK: 3993 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / b616c0f
Reports root/ big
OK: 3993 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / b616c0f
Reports root/ big
OK: 2103 / Failed: 0 / User-skipped: 783 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / b616c0f
Reports root/ big
OK: 2239 / Failed: 0 / User-skipped: 647 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / b616c0f
Reports root/ big
OK: 3967 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / b616c0f
Reports root/ big
OK: 3992 / Failed: 1 / User-skipped: 88 / Auto-skipped: 0

muc_http_api_SUITE:negative:kick_user_errors
{error,{{timeout,ok,[{times,50,not_yet}]},
    [{mongoose_helper,do_wait_until,2,
              [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
               {line,371}]},
     {muc_http_api_SUITE,kick_user_errors,1,
               [{file,"/home/circleci/project/big_tests/tests/muc_http_api_SUITE.erl"},
                {line,325}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


pgsql_mnesia_24 / pgsql_mnesia / b616c0f
Reports root/ big
OK: 4367 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / b616c0f
Reports root/ big
OK: 2581 / Failed: 0 / User-skipped: 640 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / b616c0f
Reports root/ big
OK: 4367 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / b616c0f
Reports root/ big
OK: 4353 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / b616c0f
Reports root/ big
OK: 2427 / Failed: 0 / User-skipped: 626 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / b616c0f
Reports root/ big
OK: 4389 / Failed: 2 / User-skipped: 97 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2627@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2627@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"Q9Zqpfu0asUdUjUJr3wakQ==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2636@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2636@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"QTz2prtjaCqNM1gsUF2ZcA==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / b616c0f
Reports root/ big
OK: 3993 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / b616c0f
Reports root/ big
OK: 4389 / Failed: 2 / User-skipped: 97 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2587@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2587@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"2D1frXtrtURf7TrJFSXiQw==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2599@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2599@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"nLr+LGSckf8ZQrHDVMSJZA==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


mssql_mnesia_25 / odbc_mssql_mnesia / b616c0f
Reports root/ big
OK: 4367 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@chrzaszcz chrzaszcz merged commit 6cbbb40 into master Nov 9, 2022
@chrzaszcz chrzaszcz deleted the improve-error-handling-in-account-api branch November 9, 2022 15:00
@chrzaszcz chrzaszcz added this to the 6.0.0 milestone Dec 12, 2022
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.

None yet

3 participants