diff --git a/big_tests/dynamic_domains.config b/big_tests/dynamic_domains.config index ab4d0eb2547..6ec6963722d 100644 --- a/big_tests/dynamic_domains.config +++ b/big_tests/dynamic_domains.config @@ -5,6 +5,7 @@ {domain, <<"domain.example.com">>}, {secondary_domain, <<"domain.example.org">>}, {dynamic_domains, [<<"domain.example.com">>, <<"domain.example.org">>]}, + {host_type, <<"test type">>}, {vars, "mim1"}, {cluster, mim}, {s2s_port, 5269}, diff --git a/big_tests/dynamic_domains.spec b/big_tests/dynamic_domains.spec index 2b696a13286..a42a775e6d9 100644 --- a/big_tests/dynamic_domains.spec +++ b/big_tests/dynamic_domains.spec @@ -9,7 +9,7 @@ %% http://www.erlang.org/doc/apps/common_test/run_test_chapter.html#test_specifications {include, "tests"}. -{suites, "tests", domain_isolation_SUITE}. +{suites, "tests", acc_e2e_SUITE}. {config, ["dynamic_domains.config", "test.config"]}. {logdir, "ct_report"}. diff --git a/big_tests/tests/acc_e2e_SUITE.erl b/big_tests/tests/acc_e2e_SUITE.erl index e19bcc86a53..9579aeb8ced 100644 --- a/big_tests/tests/acc_e2e_SUITE.erl +++ b/big_tests/tests/acc_e2e_SUITE.erl @@ -170,12 +170,13 @@ acc_test_helper_code(Config) -> binary_to_list(Code). add_handler(Hook, F, Seq) -> - rpc(mim(), ejabberd_hooks, add, [Hook, host(), acc_test_helper, F, Seq]). + rpc(mim(), ejabberd_hooks, add, handler(Hook, F, Seq)). remove_handler(Hook, F, Seq) -> - rpc(mim(), ejabberd_hooks, delete, [Hook, host(), acc_test_helper, F, Seq]). + rpc(mim(), ejabberd_hooks, delete, handler(Hook, F, Seq)). -host() -> <<"localhost">>. +handler(Hook, F, Seq) -> + [Hook, domain_helper:host_type(mim), acc_test_helper, F, Seq]. %% creates a temporary ets table keeping refs and some attrs of accumulators created in c2s recreate_table() -> diff --git a/big_tests/tests/domain_helper.erl b/big_tests/tests/domain_helper.erl index 916ad7647fe..6f3c56a6c06 100644 --- a/big_tests/tests/domain_helper.erl +++ b/big_tests/tests/domain_helper.erl @@ -2,27 +2,35 @@ -export([insert_configured_domains/0, delete_configured_domains/0, - insert_domain/2, - delete_domain/2]). + insert_domain/3, + delete_domain/2, + host_type/1, + host_type/2]). -import(distributed_helper, [get_or_fail/1, rpc/4]). +host_type(NodeKey) -> + host_type(NodeKey, domain). + +host_type(NodeKey, DomainKey) -> + Node = #{node => get_or_fail({hosts, NodeKey, node})}, + Domain = get_or_fail({hosts, NodeKey, DomainKey}), + {ok, HostType} = rpc(Node, mongoose_domain_core, get_host_type, [Domain]), + HostType. + insert_configured_domains() -> - for_each_configured_domain(fun insert_domain/2). + for_each_configured_domain(fun insert_domain/3). delete_configured_domains() -> - for_each_configured_domain(fun delete_domain/2). + for_each_configured_domain(fun(Node, Domain, _) -> delete_domain(Node, Domain) end). -insert_domain(Node, Domain) -> - ok = rpc(Node, mongoose_domain_core, insert, [Domain, host_type(), dummy_source]). +insert_domain(Node, Domain, HostType) -> + ok = rpc(Node, mongoose_domain_core, insert, [Domain, HostType, dummy_source]). delete_domain(Node, Domain) -> ok = rpc(Node, mongoose_domain_core, delete, [Domain]). for_each_configured_domain(F) -> - [F(#{node => proplists:get_value(node, Opts)}, Domain) || + [F(#{node => proplists:get_value(node, Opts)}, Domain, proplists:get_value(host_type, Opts)) || {_, Opts} <- ct:get_config(hosts), Domain <- proplists:get_value(dynamic_domains, Opts, [])]. - -host_type() -> - <<"test type">>. %% preconfigured in the toml file diff --git a/big_tests/tests/dynamic_domains_pm_SUITE.erl b/big_tests/tests/dynamic_domains_pm_SUITE.erl index ba049a1ab24..7fbf59cc35f 100644 --- a/big_tests/tests/dynamic_domains_pm_SUITE.erl +++ b/big_tests/tests/dynamic_domains_pm_SUITE.erl @@ -71,7 +71,7 @@ auth_domain_removal_is_triggered_on_hook(_Config) -> %% helper functions insert_domains(Nodes, Domains) -> - [domain_helper:insert_domain(Node, Domain) || Node <- Nodes, Domain <- Domains]. + [domain_helper:insert_domain(Node, Domain, ?HOST_TYPE) || Node <- Nodes, Domain <- Domains]. remove_domains(Nodes, Domains) -> [domain_helper:delete_domain(Node, Domain) || Node <- Nodes, Domain <- Domains].