Skip to content

Commit d4c8dbc

Browse files
committed
dynamic_ha_SUITE: Log the failing set of policies
References rabbitmq#889. [#126767013]
1 parent 0fdce27 commit d4c8dbc

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/dynamic_ha_SUITE.erl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,10 @@ test_random_policy(Config, Nodes, Policies) ->
370370
rabbit_ct_client_helpers:publish(Ch, ?QNAME, 100000),
371371
%% Apply policies in parallel on all nodes
372372
apply_in_parallel(Config, Nodes, Policies),
373-
%% The last policy is the final state
374-
Last = lists:last(Policies),
375373
%% Give it some time to generate all internal notifications
376374
timer:sleep(2000),
377375
%% Check the result
378-
Result = wait_for_last_policy(?QNAME, NodeA, Last, 30),
376+
Result = wait_for_last_policy(?QNAME, NodeA, Policies, 30),
379377
%% Cleanup
380378
amqp_channel:call(Ch, #'queue.delete'{queue = ?QNAME}),
381379
_ = rabbit_ct_broker_helpers:clear_policy(Config, NodeA, ?POLICY),
@@ -408,7 +406,7 @@ nodes_gen(Nodes) ->
408406
sets:to_list(sets:from_list(List))).
409407

410408
%% Checks
411-
wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
409+
wait_for_last_policy(QueueName, NodeA, TestedPolicies, Tries) ->
412410
%% Ensure the owner/master is able to process a call request,
413411
%% which means that all pending casts have been processed.
414412
%% Use the information returned by owner/master to verify the
@@ -422,23 +420,26 @@ wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
422420
%% The queue is probably being migrated to another node.
423421
%% Let's wait a bit longer.
424422
timer:sleep(1000),
425-
wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries - 1);
423+
wait_for_last_policy(QueueName, NodeA, TestedPolicies, Tries - 1);
426424
FinalInfo ->
425+
%% The last policy is the final state
426+
LastPolicy = lists:last(TestedPolicies),
427427
case verify_policy(LastPolicy, FinalInfo) of
428428
true ->
429429
true;
430430
false when Tries =:= 1 ->
431431
Policies = rpc:call(Node, rabbit_policy, list, [], 5000),
432432
ct:pal(
433433
"Last policy not applied:~n"
434-
" Queue node: ~s (~p)~n"
435-
" Queue info: ~p~n"
436-
" Policies: ~p",
437-
[Node, Pid, FinalInfo, Policies]),
434+
" Queue node: ~s (~p)~n"
435+
" Queue info: ~p~n"
436+
" Configured policies: ~p~n"
437+
" Tested policies: ~p",
438+
[Node, Pid, FinalInfo, Policies, TestedPolicies]),
438439
false;
439440
false ->
440441
timer:sleep(1000),
441-
wait_for_last_policy(QueueName, NodeA, LastPolicy,
442+
wait_for_last_policy(QueueName, NodeA, TestedPolicies,
442443
Tries - 1)
443444
end
444445
end.

0 commit comments

Comments
 (0)