Skip to content

Commit 7a7ca35

Browse files
committed
Test updated, and make use of binary type in cuttlefish to avoid conversions
1 parent f199d12 commit 7a7ca35

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ fun(Conf) ->
26892689
end}.
26902690

26912691
{mapping, "cluster_tags.$tag", "rabbit.cluster_tags", [
2692-
{datatype, [string]}
2692+
{datatype, [binary]}
26932693
]}.
26942694

26952695
{translation, "rabbit.cluster_tags",
@@ -2698,7 +2698,7 @@ fun(Conf) ->
26982698
none -> [];
26992699
_ ->
27002700
Settings = cuttlefish_variable:filter_by_prefix("cluster_tags", Conf),
2701-
[ {K, V} || {[_, K], V} <- Settings]
2701+
[ {list_to_binary(K), V} || {[_, K], V} <- Settings]
27022702
end
27032703
end}.
27042704

deps/rabbitmq_management/src/rabbit_mgmt_wm_overview.erl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ cluster_tags() ->
188188
case application:get_env(rabbit, cluster_tags) of
189189
undefined ->
190190
[];
191-
{ok, Tags} ->
192-
lists:map(fun({K, V}) ->
193-
{list_to_binary(K), list_to_binary(V)}
194-
end,
195-
Tags)
191+
{ok, Tags} ->
192+
Tags
196193
end.

deps/rabbitmq_management/test/rabbit_mgmt_http_SUITE.erl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ definitions_group4_tests() ->
106106

107107

108108
all_tests() -> [
109+
cluster_tags_test,
109110
cli_redirect_test,
110111
api_redirect_test,
111112
stats_redirect_test,
@@ -283,6 +284,11 @@ init_per_testcase(Testcase = disabled_qq_replica_opers_test, Config) ->
283284
rabbit_ct_broker_helpers:rpc_all(Config,
284285
application, set_env, [rabbitmq_management, restrictions, Restrictions]),
285286
rabbit_ct_helpers:testcase_started(Config, Testcase);
287+
init_per_testcase(Testcase = cluster_tags_test, Config) ->
288+
Tags = [{<<"az">>, <<"us-east-3">>}, {<<"region">>,<<"us-east">>}, {<<"environment">>,<<"production">>}],
289+
rabbit_ct_broker_helpers:rpc_all(Config,
290+
application, set_env, [rabbit, cluster_tags, Tags]),
291+
rabbit_ct_helpers:testcase_started(Config, Testcase);
286292
init_per_testcase(queues_detailed_test, Config) ->
287293
IsEnabled = rabbit_ct_broker_helpers:is_feature_flag_enabled(
288294
Config, detailed_queues_endpoint),
@@ -3721,6 +3727,14 @@ rates_test(Config) ->
37213727
http_delete(Config, "/queues/%2F/myqueue", ?NO_CONTENT),
37223728
passed.
37233729

3730+
cluster_tags_test(Config) ->
3731+
Overview = http_get(Config, "/overview"),
3732+
Tags = maps:get(cluster_tags, Overview),
3733+
ExpectedTags = #{az => <<"us-east-3">>,environment => <<"production">>,
3734+
region => <<"us-east">>},
3735+
?assertEqual(ExpectedTags, Tags),
3736+
passed.
3737+
37243738
cli_redirect_test(Config) ->
37253739
assert_permanent_redirect(Config, "cli", "/cli/index.html"),
37263740
passed.

0 commit comments

Comments
 (0)