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

MIM-1536 Return error 404 instead of 500 if GET command not found #3383

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

arcusfelis
Copy link
Contributor

This PR addresses MIM-1536

Proposed changes include:

  • This is already done for POST commands
  • This is kinda different from non_existent_command_returns404 testcase :)

This command:
curl -v "http://localhost:8088/api/contacts/"

should return error 404, not 500.

This command is a valid working command fyi:
curl -v "http://localhost:8088/api/contacts/alice@localhost"

It's already done for POST commands.

@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #3383 (a48a52e) into master (fc29465) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3383      +/-   ##
==========================================
+ Coverage   80.72%   80.76%   +0.03%     
==========================================
  Files         397      397              
  Lines       32268    32269       +1     
==========================================
+ Hits        26049    26062      +13     
+ Misses       6219     6207      -12     
Impacted Files Coverage Δ
src/mongoose_api_admin.erl 83.05% <100.00%> (+0.29%) ⬆️
src/mod_last_rdbms.erl 96.15% <0.00%> (-3.85%) ⬇️
...c/global_distrib/mod_global_distrib_server_mgr.erl 74.57% <0.00%> (-2.26%) ⬇️
src/mod_last.erl 86.76% <0.00%> (-1.48%) ⬇️
src/logger/mongoose_log_filter.erl 78.08% <0.00%> (-1.37%) ⬇️
src/global_distrib/mod_global_distrib_receiver.erl 78.88% <0.00%> (-1.12%) ⬇️
src/ejabberd_c2s.erl 89.20% <0.00%> (-0.37%) ⬇️
src/mod_muc_log.erl 78.11% <0.00%> (ø)
src/pubsub/mod_pubsub_db_rdbms.erl 95.34% <0.00%> (+0.25%) ⬆️
src/auth/ejabberd_auth_rdbms.erl 56.96% <0.00%> (+0.60%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc29465...a48a52e. Read the comment docs.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Nov 3, 2021

small_tests_24 / small_tests / 0f75db5
Reports root / small


internal_mnesia_24 / internal_mnesia / 0f75db5
Reports root/ big
OK: 1586 / Failed: 0 / User-skipped: 297 / Auto-skipped: 0


small_tests_23 / small_tests / 0f75db5
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 0f75db5
Reports root/ big
OK: 1486 / Failed: 1 / User-skipped: 400 / Auto-skipped: 0

mod_event_pusher_rabbit_SUITE:group_chat_message_publish:group_chat_message_received_event_properly_formatted
{error,
  {{assertMatch,
     [{module,mod_event_pusher_rabbit_SUITE},
      {line,435},
      {expression,
        "get_decoded_message_from_rabbit ( AliceGroupChatMsgRecvRK )"},
      {pattern,
        "# { << \"from_user_id\" >> := BobRoomJID , << \"to_user_id\" >> := AliceFullJID , << \"message\" >> := Message }"},
      {value,
        #{<<"from_user_id">> =>
          <<"muc_publish@muc.localhost/bOb_unnamed_37.452080">>,
        <<"message">> => <<"Hi there!">>,
        <<"to_user_id">> =>
          <<"alice_unnamed_37.570246@localhost/res1">>}}]},
   [{mod_event_pusher_rabbit_SUITE,
      '-group_chat_message_received_event_properly_formatted/1-fun-1-',3,
      [{file,
         "/home/circleci/app/big_tests/tests/mod_event_pusher_rabbit_SUITE.erl"},
       {line,435}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 0f75db5
Reports root/ big
OK: 2721 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 0f75db5
Reports root/ big
OK: 2721 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 0f75db5
Reports root/ big
OK: 2749 / Failed: 1 / User-skipped: 186 / Auto-skipped: 0

sm_SUITE:parallel:messages_are_properly_flushed_during_resumption_p1_fsm_old
{error,
  {{badmatch,
     {error,
       {connection_step_failed,
         {#Fun<sm_SUITE.11.118723036>,
          {client,
            <<"alicE_messages_are_properly_flushed_during_resumption_p1_fsm_old_2.159194@domain.example.com">>,
            escalus_tcp,<0.31687.1>,undefined,
            [{username,
               <<"alicE_messages_are_properly_flushed_during_resumption_p1_fsm_old_2.159194">>},
             {server,<<"domain.example.com">>},
             {host,<<"localhost">>},
             {password,<<"matygrysa">>},
             {stream_management,true},
             {stream_id,<<"968d0efd94b1f487">>}]},
          [{compression,[<<"zlib">>]},
           {starttls,true},
           {stream_management,true},
           {advanced_message_processing,true},
           {client_state_indication,false},
           {sasl_mechanisms,[<<"SCRAM-SHA-256">>,<<"PLAIN">>]},
           {caps,undefined}]},
         {timeout,get_resumed}}}},
   [{sm_SUITE,
      '-messages_are_properly_flushed_during_resumption_p1_fsm_old/1-fun-1-',
      3,
      [{file,"/home/circleci/app/big_tests/tests/sm_SUITE.erl"},
       {line,1274}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_s...

Report log


ldap_mnesia_23 / ldap_mnesia / 0f75db5
Reports root/ big
OK: 1483 / Failed: 0 / User-skipped: 400 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 0f75db5
Reports root/ big
OK: 2704 / Failed: 0 / User-skipped: 203 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 0f75db5
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 0f75db5
Reports root/ big
OK: 1861 / Failed: 0 / User-skipped: 327 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 0f75db5
Reports root/ big
OK: 3073 / Failed: 0 / User-skipped: 230 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 0f75db5
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 0f75db5
Reports root/ big
OK: 3090 / Failed: 4 / User-skipped: 213 / Auto-skipped: 0

mod_event_pusher_rabbit_SUITE:group_chat_message_publish:group_chat_message_received_event_properly_formatted
{error,
  {{assertMatch,
     [{module,mod_event_pusher_rabbit_SUITE},
      {line,435},
      {expression,
        "get_decoded_message_from_rabbit ( AliceGroupChatMsgRecvRK )"},
      {pattern,
        "# { << \"from_user_id\" >> := BobRoomJID , << \"to_user_id\" >> := AliceFullJID , << \"message\" >> := Message }"},
      {value,
        #{<<"from_user_id">> => <<"muc_publish@muc.localhost">>,
        <<"message">> => <<>>,
        <<"to_user_id">> =>
          <<"alice_unnamed_46.42883@localhost/res1">>}}]},
   [{mod_event_pusher_rabbit_SUITE,
      '-group_chat_message_received_event_properly_formatted/1-fun-1-',3,
      [{file,
         "/home/circleci/app/big_tests/tests/mod_event_pusher_rabbit_SUITE.erl"},
       {line,435}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

service_domain_db_SUITE:db:db_keeps_syncing_after_cluster_join
{error,{test_case_failed,{[<<"example1.com">>],
              [<<"example1.com">>,<<"example2.com">>]}}}

Report log

service_domain_db_SUITE:db:rest_with_auth:rest_delete_domain_cleans_data_from_mam
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"bob_rest_delete_domain_cleans_data_from_mam_89.39192@example.org/res1">>,
          escalus_tcp,<0.13323.2>,
          [{event_manager,<0.13317.2>},
           {server,<<"example.org">>},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_89.39192">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13317.2>},
            {server,<<"example.org">>},
            {username,
              <<"bob_rest_delete_domain_cleans_data_from_mam_89.39192">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_89.39192">>},
           {server,<<"example.org">>},
           {host,<<"localhost">>},
           {port,5232},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_89.39192">>},
           {server,<<"example.org">>},
           {host,<<"localhost">>},
           {password,<<"makota3">>},
           {port,5232},
           {stream_id,<<"300f4161daba9f3a">>}]},
        5000],
       [{file,
          "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {service_domain_db_SUITE,
       '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
   ...

Report log

service_domain_db_SUITE:db:rest_without_auth:rest_delete_domain_cleans_data_from_mam
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"bob_rest_delete_domain_cleans_data_from_mam_97.620843@example.org/res1">>,
          escalus_tcp,<0.13960.2>,
          [{event_manager,<0.13954.2>},
           {server,<<"example.org">>},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_97.620843">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13954.2>},
            {server,<<"example.org">>},
            {username,
              <<"bob_rest_delete_domain_cleans_data_from_mam_97.620843">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_97.620843">>},
           {server,<<"example.org">>},
           {host,<<"localhost">>},
           {port,5232},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,
             <<"bob_rest_delete_domain_cleans_data_from_mam_97.620843">>},
           {server,<<"example.org">>},
           {host,<<"localhost">>},
           {password,<<"makota3">>},
           {port,5232},
           {stream_id,<<"97d2e1f04f3008f7">>}]},
        5000],
       [{file,
          "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {service_domain_db_SUITE,
       '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5...

Report log


riak_mnesia_24 / riak_mnesia / 0f75db5
Reports root/ big
OK: 1720 / Failed: 2 / User-skipped: 328 / Auto-skipped: 0

mod_ping_SUITE:server_ping_kill:server_ping_pong
{error,{{badmatch,[{[<<"localhost">>,mod_ping,ping_response],
          {expected_diff,5},
          {before_story,5},
          {after_story,9}}]},
    [{escalus_mongooseim,post_story_check_metrics,1,
               [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_mongooseim.erl"},
                {line,74}]},
     {escalus_mongooseim,maybe_check_metrics_post_story,1,
               [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_mongooseim.erl"},
                {line,51}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,75}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1292}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1224}]}]}}

Report log

sm_SUITE:parallel_manual_ack_freq_1:resume_session_state_stop_c2s
{error,{thrown,{timeout,msg}}}

Report log


mssql_mnesia_24 / odbc_mssql_mnesia / 0f75db5
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0

This is already done for POST commands though
@mongoose-im
Copy link
Collaborator

mongoose-im commented Nov 4, 2021

small_tests_24 / small_tests / a48a52e
Reports root / small


internal_mnesia_24 / internal_mnesia / a48a52e
Reports root/ big
OK: 1587 / Failed: 0 / User-skipped: 297 / Auto-skipped: 0


small_tests_23 / small_tests / a48a52e
Reports root / small


ldap_mnesia_24 / ldap_mnesia / a48a52e
Reports root/ big
OK: 1484 / Failed: 0 / User-skipped: 400 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / a48a52e
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / a48a52e
Reports root/ big
OK: 1484 / Failed: 0 / User-skipped: 400 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / a48a52e
Reports root/ big
OK: 2711 / Failed: 1 / User-skipped: 203 / Auto-skipped: 0

mam_SUITE:rdbms_cache_prefs_cases:messages_filtered_when_prefs_default_policy_is_roster
{error,{test_case_failed,"ASSERT EQUAL\n\tExpected []\n\tValue [ok]\n"}}

Report log


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / a48a52e
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / a48a52e
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / a48a52e
Reports root/ big
OK: 1862 / Failed: 0 / User-skipped: 327 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / a48a52e
Reports root/ big
OK: 3074 / Failed: 0 / User-skipped: 230 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / a48a52e
Reports root/ big
OK: 3091 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / a48a52e
Reports root/ big
OK: 3091 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / a48a52e
Reports root/ big
OK: 3091 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / a48a52e
Reports root/ big
OK: 1708 / Failed: 0 / User-skipped: 328 / Auto-skipped: 0

Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

Yeah, easy and fine 👌🏽

@NelsonVides NelsonVides merged commit 0abfc12 into master Nov 4, 2021
@NelsonVides NelsonVides deleted the mu-error-404-in-admin-api branch November 4, 2021 14:46
@Premwoik Premwoik modified the milestones: 5.1.0, 5.0.0 May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants