Skip to content

Commit

Permalink
Merge pull request #4444 from esl/fix-dyn-domains-test-runner
Browse files Browse the repository at this point in the history
Fix dynamic domains preset failing
  • Loading branch information
NelsonVides authored Dec 19, 2024
2 parents 770a362 + 424fb5b commit 01dad37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion big_tests/tests/domain_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ delete_domain_password(Node, Domain) ->
{ok, _} = rpc(Node, mongoose_domain_api, delete_domain_password, [Domain]).

for_each_configured_domain(F) ->
[for_each_configured_domain(F, Opts) || {_, Opts} <- ct:get_config(hosts)],
%% Skip nodes not specified in `--test-hosts'
Keys = distributed_helper:get_node_keys(),
[for_each_configured_domain(F, Opts)
|| {Key, Opts} <- ct:get_config(hosts),
lists:member(Key, Keys)],
ok.

for_each_configured_domain(F, Opts) ->
Expand Down
7 changes: 5 additions & 2 deletions test/common/distributed_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,15 @@ wait_for_nodes_to_start(NodeKeys) ->
name => wait_for_nodes_to_start}).

get_node_keys() ->
Keys = [NodeKey || {NodeKey, _Opts} <- ct:get_config(hosts)],
case os:getenv("TEST_HOSTS") of
false ->
[NodeKey || {NodeKey, _Opts} <- ct:get_config(hosts)];
Keys;
EnvValue -> %% EnvValue examples are "mim" or "mim mim2"
BinHosts = binary:split(iolist_to_binary(EnvValue), <<" ">>, [global]),
[binary_to_atom(Node, utf8) || Node <- BinHosts, Node =/= <<>>]
EnvKeys = [binary_to_atom(Node, utf8) || Node <- BinHosts, Node =/= <<>>],
%% Check only configured nodes (through test.config)
[Key || Key <- EnvKeys, lists:member(Key, Keys)]
end.

validate_node(NodeKey) ->
Expand Down

0 comments on commit 01dad37

Please sign in to comment.