summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-07-22 13:50:35 +0200
committerDiana Corbacho <diana@rabbitmq.com>2016-08-31 10:47:03 +0100
commiteca3fb9d38d68d99a1e35338c9b6fffb84310171 (patch)
tree74ab9b5ce2032a478d777b93571c4c015b446287 /test
parent666c5188a929f5eaf455795c7c3efa5d23a71dbf (diff)
downloadrabbitmq-server-git-eca3fb9d38d68d99a1e35338c9b6fffb84310171.tar.gz
dynamic_ha_SUITE: Log the failing set of policies
References #889. [#126767013]
Diffstat (limited to 'test')
-rw-r--r--test/dynamic_ha_SUITE.erl21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/dynamic_ha_SUITE.erl b/test/dynamic_ha_SUITE.erl
index e0a8329d39..ed4489a4c2 100644
--- a/test/dynamic_ha_SUITE.erl
+++ b/test/dynamic_ha_SUITE.erl
@@ -370,12 +370,10 @@ test_random_policy(Config, Nodes, Policies) ->
rabbit_ct_client_helpers:publish(Ch, ?QNAME, 100000),
%% Apply policies in parallel on all nodes
apply_in_parallel(Config, Nodes, Policies),
- %% The last policy is the final state
- Last = lists:last(Policies),
%% Give it some time to generate all internal notifications
timer:sleep(2000),
%% Check the result
- Result = wait_for_last_policy(?QNAME, NodeA, Last, 30),
+ Result = wait_for_last_policy(?QNAME, NodeA, Policies, 30),
%% Cleanup
amqp_channel:call(Ch, #'queue.delete'{queue = ?QNAME}),
_ = rabbit_ct_broker_helpers:clear_policy(Config, NodeA, ?POLICY),
@@ -408,7 +406,7 @@ nodes_gen(Nodes) ->
sets:to_list(sets:from_list(List))).
%% Checks
-wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
+wait_for_last_policy(QueueName, NodeA, TestedPolicies, Tries) ->
%% Ensure the owner/master is able to process a call request,
%% which means that all pending casts have been processed.
%% Use the information returned by owner/master to verify the
@@ -422,8 +420,10 @@ wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
%% The queue is probably being migrated to another node.
%% Let's wait a bit longer.
timer:sleep(1000),
- wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries - 1);
+ wait_for_last_policy(QueueName, NodeA, TestedPolicies, Tries - 1);
FinalInfo ->
+ %% The last policy is the final state
+ LastPolicy = lists:last(TestedPolicies),
case verify_policy(LastPolicy, FinalInfo) of
true ->
true;
@@ -431,14 +431,15 @@ wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
Policies = rpc:call(Node, rabbit_policy, list, [], 5000),
ct:pal(
"Last policy not applied:~n"
- " Queue node: ~s (~p)~n"
- " Queue info: ~p~n"
- " Policies: ~p",
- [Node, Pid, FinalInfo, Policies]),
+ " Queue node: ~s (~p)~n"
+ " Queue info: ~p~n"
+ " Configured policies: ~p~n"
+ " Tested policies: ~p",
+ [Node, Pid, FinalInfo, Policies, TestedPolicies]),
false;
false ->
timer:sleep(1000),
- wait_for_last_policy(QueueName, NodeA, LastPolicy,
+ wait_for_last_policy(QueueName, NodeA, TestedPolicies,
Tries - 1)
end
end.