Skip to content
This repository was archived by the owner on Nov 14, 2020. It is now read-only.

Commit e5124f9

Browse files
gerharddumbbell
authored andcommitted
Add tests for product name & version
Signed-off-by: Gerhard Lazu <[email protected]> (cherry picked from commit 4337100)
1 parent 926b297 commit e5124f9

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

test/rabbit_prometheus_http_SUITE.erl

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,34 @@ all() ->
2929
{group, config_path},
3030
{group, config_port},
3131
{group, aggregated_metrics},
32-
{group, per_object_metrics}
32+
{group, per_object_metrics},
33+
{group, commercial}
3334
].
3435

3536
groups() ->
3637
[
37-
{default_config, [], all_tests()},
38-
{config_path, [], all_tests()},
39-
{config_port, [], all_tests()},
38+
{default_config, [], generic_tests()},
39+
{config_path, [], generic_tests()},
40+
{config_port, [], generic_tests()},
4041
{aggregated_metrics, [], [
41-
aggregated_metrics_test,
42-
build_info_test,
43-
identity_info_test
42+
aggregated_metrics_test
4443
]},
4544
{per_object_metrics, [], [
46-
per_object_metrics_test,
47-
build_info_test,
48-
identity_info_test
45+
per_object_metrics_test
46+
]},
47+
{commercial, [], [
48+
build_info_product_test
4949
]}
5050
].
5151

52-
all_tests() ->
52+
generic_tests() ->
5353
[
54-
get_test,
55-
content_type_test,
56-
encoding_test,
57-
gzip_encoding_test
54+
get_test,
55+
content_type_test,
56+
encoding_test,
57+
gzip_encoding_test,
58+
build_info_test,
59+
identity_info_test
5860
].
5961

6062
%% -------------------------------------------------------------------
@@ -104,7 +106,11 @@ init_per_group(aggregated_metrics, Config0) ->
104106
amqp_channel:subscribe(Ch, #'basic.consume'{queue = Q}, ConsumerPid),
105107
timer:sleep(10000),
106108

107-
Config2 ++ [{channel_pid, Ch}, {queue_name, Q}, {consumer_tag, CTag}, {consumer_pid, ConsumerPid}].
109+
Config2 ++ [{channel_pid, Ch}, {queue_name, Q}, {consumer_tag, CTag}, {consumer_pid, ConsumerPid}];
110+
init_per_group(commercial, Config0) ->
111+
ProductConfig = {rabbit, [{product_name, "WolfMQ"}, {product_version, "2020"}]},
112+
Config1 = rabbit_ct_helpers:merge_app_env(Config0, ProductConfig),
113+
init_per_group(commercial, Config1, []).
108114

109115
init_per_group(Group, Config0, Extra) ->
110116
rabbit_ct_helpers:log_environment(),
@@ -250,6 +256,13 @@ build_info_test(Config) ->
250256
?assertEqual(match, re:run(Body, "prometheus_client_version=\"", [{capture, none}])),
251257
?assertEqual(match, re:run(Body, "erlang_version=\"", [{capture, none}])).
252258

259+
build_info_product_test(Config) ->
260+
{_Headers, Body} = http_get_with_pal(Config, [], 200),
261+
?assertEqual(match, re:run(Body, "product_name=\"WolfMQ\"", [{capture, none}])),
262+
?assertEqual(match, re:run(Body, "product_version=\"2020\"", [{capture, none}])),
263+
%% Check that RabbitMQ version is still displayed
264+
?assertEqual(match, re:run(Body, "rabbitmq_version=\"", [{capture, none}])).
265+
253266
identity_info_test(Config) ->
254267
{_Headers, Body} = http_get_with_pal(Config, [], 200),
255268
?assertEqual(match, re:run(Body, "^rabbitmq_identity_info{", [{capture, none}, multiline])),

0 commit comments

Comments
 (0)