summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-04-15 10:36:51 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-04-15 10:36:51 +0200
commit35bc1cd98c3d9033103fac630b838a8296319459 (patch)
tree0e5368bd1d6805d332dc105d6d28ee71bdc4b3f4 /test
parent442768afdcbdcf1c08d9ca90f1704cfceae4734f (diff)
downloadrabbitmq-server-git-35bc1cd98c3d9033103fac630b838a8296319459.tar.gz
clustering_management_SUITE: Adapt `status_with_alarm` to the new `cluster_status` output
The struct inside the `alarms` key was changed. While here, change how the rabbitmqctl(8) output is parsed: we now parse the Erlang structure instead of using regex.
Diffstat (limited to 'test')
-rw-r--r--test/clustering_management_SUITE.erl22
1 files changed, 8 insertions, 14 deletions
diff --git a/test/clustering_management_SUITE.erl b/test/clustering_management_SUITE.erl
index 40317ec604..083e69539b 100644
--- a/test/clustering_management_SUITE.erl
+++ b/test/clustering_management_SUITE.erl
@@ -665,9 +665,9 @@ status_with_alarm(Config) ->
%% When: we ask for cluster status.
{ok, S} = rabbit_ct_broker_helpers:rabbitmqctl(Config, Rabbit,
- ["cluster_status"]),
+ ["cluster_status", "--silent"]),
{ok, R} = rabbit_ct_broker_helpers:rabbitmqctl(Config, Hare,
- ["cluster_status"]),
+ ["cluster_status", "--silent"]),
%% Then: both nodes have printed alarm information for eachother.
ok = alarm_information_on_each_node(S, Rabbit, Hare),
@@ -866,18 +866,12 @@ declare(Ch, Name) ->
Res.
alarm_information_on_each_node(Output, Rabbit, Hare) ->
+ {ok, Tokens, _} = erl_scan:string(Output ++ "."),
+ {ok, Exprs} = erl_parse:parse_exprs(Tokens),
+ {value, Status, _} = erl_eval:exprs(Exprs, erl_eval:new_bindings()),
- A = string:str(Output, "alarms"), true = A > 0,
-
- %% Test that names are printed after `alarms': this counts on
- %% output with a `{Name, Value}' kind of format, for listing
- %% alarms, so that we can miss any node names in preamble text.
- Alarms = string:substr(Output, A),
- RabbitStr = atom_to_list(Rabbit),
- HareStr = atom_to_list(Hare),
- match = re:run(Alarms, "\\{'?" ++ RabbitStr ++ "'?,\\[memory\\]\\}",
- [{capture, none}]),
- match = re:run(Alarms, "\\{'?" ++ HareStr ++ "'?,\\[disk\\]\\}",
- [{capture, none}]),
+ Alarms = proplists:get_value(alarms, Status),
+ ?assert(lists:member({Rabbit, [{resource_limit, memory, Rabbit}]}, Alarms)),
+ ?assert(lists:member({Hare, [{resource_limit, disk, Hare}]}, Alarms)),
ok.