Skip to content

Commit

Permalink
Add metric_host_type option
Browse files Browse the repository at this point in the history
So we can test metrics in an easy way
  • Loading branch information
arcusfelis committed Jun 9, 2022
1 parent 21ec042 commit 6cdf682
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions big_tests/dynamic_domains.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{hosts, [{mim, [{node, mongooseim@localhost},
{domain, <<"domain.example.com">>},
{host_type, <<"test type">>},
{metric_host_type, <<"test_type">>},
{secondary_domain, <<"domain.example.org">>},
{secondary_host_type, <<"test type">>},
{dynamic_domains, [{<<"test type">>, [<<"domain.example.com">>, <<"domain.example.org">>]},
Expand Down
1 change: 1 addition & 0 deletions big_tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{hosts, [{mim, [{node, mongooseim@localhost},
{domain, <<"localhost">>},
{host_type, <<"localhost">>},
{metric_host_type, <<"localhost">>},
{vars, "mim1"},
{cluster, mim},
{secondary_domain, <<"localhost.bis">>},
Expand Down
4 changes: 4 additions & 0 deletions big_tests/tests/domain_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
host_types/1,
host_type/0,
host_type/1,
metric_host_type/0,
domain_to_host_type/2,
domain/0,
domain/1,
Expand All @@ -34,6 +35,9 @@ domain() ->
host_type(NodeKey) ->
get_or_fail({hosts, NodeKey, host_type}).

metric_host_type() ->
get_or_fail({hosts, mim, metric_host_type}).

domain_to_host_type(Node, Domain) ->
{ok, HostType} = rpc(Node, mongoose_domain_core, get_host_type, [Domain]),
HostType.
Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/graphql_metric_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ get_metrics_as_dicts_with_key_one(Config) ->
operationName => <<"Q1">>}, Config),
ParsedResult = ok_result(<<"metric">>, <<"getMetricsAsDicts">>, Result),
Map = dict_objects_to_map(ParsedResult),
SentName = [domain_helper:host_type(), <<"xmppStanzaSent">>],
SentName = [domain_helper:metric_host_type(), <<"xmppStanzaSent">>],
[#{<<"key">> := <<"one">>, <<"value">> := One}] = maps:get(SentName, Map),
true = is_integer(One).

Expand Down Expand Up @@ -208,7 +208,7 @@ check_node_result_is_valid(ResList, MetricsAreGlobal) ->
Map = dict_objects_to_map(ResList),
SentName = case MetricsAreGlobal of
true -> [<<"global">>, <<"xmppStanzaSent">>];
false -> [domain_helper:host_type(), <<"xmppStanzaSent">>]
false -> [domain_helper:metric_host_type(), <<"xmppStanzaSent">>]
end,
check_spiral_dict(maps:get(SentName, Map)),
[#{<<"key">> := <<"value">>,<<"value">> := V}] =
Expand Down

0 comments on commit 6cdf682

Please sign in to comment.