-
Notifications
You must be signed in to change notification settings - Fork 428
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
Rework domain API module #3851
Rework domain API module #3851
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportBase: 83.08% // Head: 83.10% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3851 +/- ##
==========================================
+ Coverage 83.08% 83.10% +0.01%
==========================================
Files 535 535
Lines 34118 34089 -29
==========================================
- Hits 28348 28328 -20
+ Misses 5770 5761 -9
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. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
b0590ba
to
512cd1c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
512cd1c
to
37b041b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
- Return two-element tuples as it is the current convention - Fold over step functions because there are multiple common steps - Return errors on duplicate deletion/insertion. This prevents the user from interpreting the 'ok' result as successful operation if the supplied domain name was wrong. - Don't check for enabled service - it is done once for all operations now.
- Check if service_domain_db is enabled - Use stringprepping for domain names - Don't nest deleted domain - use a separate status value 'deleted' instead - Require non-empty passwords
Services have no host type, so no argument is needed in the directive.
It is a bit easier (and more consistent with the remaining API) to use maps.
Don't accept empty strings.
- Use the new API, which returns error tuples
- Check if the service is enabled - Use the error messages from the 2-element tuples
- Check if the service is running - Use the error messages
Update expected results: - Errors on duplicate operations - New error messages - Deleted domain is not nested
Update expected results: - Two-element tuples are returned from the external API - Database errors don't have special handling - Errors on duplicate operations - New error messages
37b041b
to
3a00cce
Compare
small_tests_24 / small_tests / 3a00cce small_tests_25 / small_tests / 3a00cce dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 3a00cce ldap_mnesia_24 / ldap_mnesia / 3a00cce ldap_mnesia_25 / ldap_mnesia / 3a00cce dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 3a00cce dynamic_domains_mysql_redis_25 / mysql_redis / 3a00cce dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 3a00cce elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 3a00cce internal_mnesia_25 / internal_mnesia / 3a00cce service_mongoose_system_metrics_SUITE:system_metrics_are_reported_to_configurable_google_analytics{error,
{{assertEqual,
[{module,service_mongoose_system_metrics_SUITE},
{line,470},
{expression,"ActualTrackingIds"},
{expected,[<<"UA-151671255-1">>,<<"UA-EXTRA-TRACKING-ID">>]},
{value,[<<"UA-151671255-1">>]}]},
[{service_mongoose_system_metrics_SUITE,
events_are_reported_to_tracking_ids,1,
[{file,
"/home/circleci/project/big_tests/tests/service_mongoose_system_metrics_SUITE.erl"},
{line,470}]},
{service_mongoose_system_metrics_SUITE,
system_metrics_are_reported_to_configurable_google_analytics,1,
[{file,
"/home/circleci/project/big_tests/tests/service_mongoose_system_metrics_SUITE.erl"},
{line,204}]},
{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}]}]}} pgsql_mnesia_24 / pgsql_mnesia / 3a00cce pgsql_mnesia_25 / pgsql_mnesia / 3a00cce riak_mnesia_24 / riak_mnesia / 3a00cce mysql_redis_25 / mysql_redis / 3a00cce mssql_mnesia_25 / odbc_mssql_mnesia / 3a00cce pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_2592@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_2592@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"RLDigYs1ggHvel7bMsJ6Fg==">>}],
[{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}]}]}} pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_2604@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_2604@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"Gl18M7Oap2CnO7dP+RssWQ==">>}],
[{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}]}]}} push_integration_SUITE:pubsub_less:pm_notifications_with_inbox:inbox_msg_reset_unread_count_apns{error,
{{assertMatch,
[{module,push_integration_SUITE},
{line,662},
{expression,"Data"},
{pattern,"# { << \"message-count\" >> := ExpectedCount }"},
{value,
#{<<"last-message-body">> => <<"THIRD MESSAGE">>,
<<"last-message-sender">> =>
<<"alice_inbox_msg_reset_unread_count_apns_2908@localhost">>,
<<"message-count">> => 2}}]},
[{push_integration_SUITE,check_notification,2,
[{file,
"/home/circleci/project/big_tests/tests/push_integration_SUITE.erl"},
{line,662}]},
{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}]}]}} internal_mnesia_25 / internal_mnesia / 3a00cce mssql_mnesia_25 / odbc_mssql_mnesia / 3a00cce |
1e2d731
to
ce0c961
Compare
small_tests_24 / small_tests / 1e2d731 small_tests_25 / small_tests / 1e2d731 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 1e2d731 ldap_mnesia_24 / ldap_mnesia / 1e2d731 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 1e2d731 ldap_mnesia_25 / ldap_mnesia / 1e2d731 dynamic_domains_mysql_redis_25 / mysql_redis / 1e2d731 pgsql_mnesia_24 / pgsql_mnesia / 1e2d731 pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_2590@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_2590@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"79RXSeIgXjzz4NUpkeLZVA==">>}],
[{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,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}]}]}} internal_mnesia_25 / internal_mnesia / 1e2d731 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 1e2d731 inbox_extensions_SUITE:regular:one_to_one:pagination:max_queries_can_fetch_ahead{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"kate_max_queries_can_fetch_ahead_1499@domain.example.com/res1">>,
escalus_tcp,<0.7482.1>,
[{event_manager,<0.7467.1>},
{server,<<"domain.example.com">>},
{username,<<"kate_max_queries_can_fetch_ahead_1499">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.7467.1>},
{server,<<"domain.example.com">>},
{username,<<"kate_max_queries_can_fetch_ahead_1499">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"kate_max_queries_can_fetch_ahead_1499">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"kate_max_queries_can_fetch_ahead_1499">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{password,<<"makrowe;p">>},
{stream_id,<<"e5293f06e75424f7">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{inbox_helper,'-given_conversations_between/2-fun-1-',4,
[{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
{line,540}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1355}]},... inbox_extensions_SUITE:regular:one_to_one:pagination:can_paginate_backwards{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"mike_can_paginate_backwards_1496@domain.example.com/res1">>,
escalus_tcp,<0.7485.1>,
[{event_manager,<0.7446.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_can_paginate_backwards_1496">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.7446.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_can_paginate_backwards_1496">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"mike_can_paginate_backwards_1496">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"mike_can_paginate_backwards_1496">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{password,<<"nicniema">>},
{stream_id,<<"64fc4a38bbbfcf71">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{inbox_helper,'-given_conversations_between/2-fun-1-',4,
[{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
{line,540}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1355}]},
{inbox_extensions_SU... inbox_extensions_SUITE:regular:one_to_one:pagination:pagination_overrides_form{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"mike_pagination_overrides_form_1498@domain.example.com/res1">>,
escalus_tcp,<0.7487.1>,
[{event_manager,<0.7460.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_pagination_overrides_form_1498">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.7460.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_pagination_overrides_form_1498">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"mike_pagination_overrides_form_1498">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"mike_pagination_overrides_form_1498">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{password,<<"nicniema">>},
{stream_id,<<"ca58f71c12cfe8b6">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{inbox_helper,'-given_conversations_between/2-fun-1-',4,
[{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
{line,540}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1355}]},
{inbo... inbox_extensions_SUITE:regular:one_to_one:pagination:max_queries_can_be_limited{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"mike_max_queries_can_be_limited_1494@domain.example.com/res1">>,
escalus_tcp,<0.7484.1>,
[{event_manager,<0.7432.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_max_queries_can_be_limited_1494">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.7432.1>},
{server,<<"domain.example.com">>},
{username,<<"mike_max_queries_can_be_limited_1494">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"mike_max_queries_can_be_limited_1494">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{port,5222},
{auth,{escalus_auth,auth_plain}},
{wspath,undefined},
{username,<<"mike_max_queries_can_be_limited_1494">>},
{server,<<"domain.example.com">>},
{host,<<"localhost">>},
{password,<<"nicniema">>},
{stream_id,<<"658679c19cce420c">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{inbox_helper,'-given_conversations_between/2-fun-1-',4,
[{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
{line,540}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1355}]},
... elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 1e2d731 riak_mnesia_24 / riak_mnesia / 1e2d731 pgsql_mnesia_25 / pgsql_mnesia / 1e2d731 mysql_redis_25 / mysql_redis / 1e2d731 mssql_mnesia_25 / odbc_mssql_mnesia / 1e2d731 |
small_tests_24 / small_tests / ce0c961 small_tests_25 / small_tests / ce0c961 ldap_mnesia_24 / ldap_mnesia / ce0c961 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / ce0c961 dynamic_domains_mysql_redis_25 / mysql_redis / ce0c961 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / ce0c961 ldap_mnesia_25 / ldap_mnesia / ce0c961 pgsql_mnesia_24 / pgsql_mnesia / ce0c961 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / ce0c961 internal_mnesia_25 / internal_mnesia / ce0c961 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / ce0c961 pgsql_mnesia_25 / pgsql_mnesia / ce0c961 riak_mnesia_24 / riak_mnesia / ce0c961 mysql_redis_25 / mysql_redis / ce0c961 mssql_mnesia_25 / odbc_mssql_mnesia / ce0c961 |
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.
Looks good
The main goal is to make
mongoose_domain_api
more consistent with the other*_api
modules used by the GraphQL and REST APIs:@use
directive.Other important changes:
@use
directive for services.DomainName
type that is string-prepped on input. It does not accept empty strings as well.DELETED
status that is used only to mark successful deletion.