@@ -370,12 +370,10 @@ test_random_policy(Config, Nodes, Policies) ->
370
370
rabbit_ct_client_helpers :publish (Ch , ? QNAME , 100000 ),
371
371
% % Apply policies in parallel on all nodes
372
372
apply_in_parallel (Config , Nodes , Policies ),
373
- % % The last policy is the final state
374
- Last = lists :last (Policies ),
375
373
% % Give it some time to generate all internal notifications
376
374
timer :sleep (2000 ),
377
375
% % Check the result
378
- Result = wait_for_last_policy (? QNAME , NodeA , Last , 30 ),
376
+ Result = wait_for_last_policy (? QNAME , NodeA , Policies , 30 ),
379
377
% % Cleanup
380
378
amqp_channel :call (Ch , # 'queue.delete' {queue = ? QNAME }),
381
379
_ = rabbit_ct_broker_helpers :clear_policy (Config , NodeA , ? POLICY ),
@@ -408,7 +406,7 @@ nodes_gen(Nodes) ->
408
406
sets :to_list (sets :from_list (List ))).
409
407
410
408
% % Checks
411
- wait_for_last_policy (QueueName , NodeA , LastPolicy , Tries ) ->
409
+ wait_for_last_policy (QueueName , NodeA , TestedPolicies , Tries ) ->
412
410
% % Ensure the owner/master is able to process a call request,
413
411
% % which means that all pending casts have been processed.
414
412
% % Use the information returned by owner/master to verify the
@@ -422,23 +420,26 @@ wait_for_last_policy(QueueName, NodeA, LastPolicy, Tries) ->
422
420
% % The queue is probably being migrated to another node.
423
421
% % Let's wait a bit longer.
424
422
timer :sleep (1000 ),
425
- wait_for_last_policy (QueueName , NodeA , LastPolicy , Tries - 1 );
423
+ wait_for_last_policy (QueueName , NodeA , TestedPolicies , Tries - 1 );
426
424
FinalInfo ->
425
+ % % The last policy is the final state
426
+ LastPolicy = lists :last (TestedPolicies ),
427
427
case verify_policy (LastPolicy , FinalInfo ) of
428
428
true ->
429
429
true ;
430
430
false when Tries =:= 1 ->
431
431
Policies = rpc :call (Node , rabbit_policy , list , [], 5000 ),
432
432
ct :pal (
433
433
" 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 ]),
438
439
false ;
439
440
false ->
440
441
timer :sleep (1000 ),
441
- wait_for_last_policy (QueueName , NodeA , LastPolicy ,
442
+ wait_for_last_policy (QueueName , NodeA , TestedPolicies ,
442
443
Tries - 1 )
443
444
end
444
445
end .
0 commit comments