@@ -861,30 +861,7 @@ temporary_queue_after_partition_recovery_2(Config, QueueDeclare) ->
861861 Conn1 , Ch1 )
862862 end ),
863863
864- KhepriTimeout = rabbit_ct_broker_helpers :rpc (Config , Node2 , khepri_app , get_default_timeout , []),
865- ct :pal (" Sleep > ~b ms" , [KhepriTimeout ]),
866- timer :sleep (KhepriTimeout + 10000 ),
867-
868- % % Close the second consuming client to trigger the queue deletion during
869- % % the network partition. This time, the partition is solved while the
870- % % queue process tries to delete the record.
871- ct :pal (" Close connection 2" ),
872- _ = spawn (fun () ->
873- rabbit_ct_client_helpers :close_connection_and_channel (
874- Conn2 , Ch2 )
875- end ),
876-
877- % % We resolve the network partition.
878- lists :foreach (
879- fun (Node ) ->
880- ct :pal (" Allow traffic with ~s " , [Node ]),
881- rabbit_ct_broker_helpers :allow_traffic_between (
882- Node2 , Node )
883- end , Majority ),
884- ct :pal (" Cluster status" ),
885- clustering_utils :assert_cluster_status ({Nodes , Nodes }, Nodes ),
886-
887- ct :pal (" Wait for connection DOWN" ),
864+ ct :pal (" Wait for connection 1 DOWN" ),
888865 receive
889866 {'DOWN' , CMRef1 , _ , _ , Reason1_1 } ->
890867 ct :pal (" Connection ~p exited: ~p " , [Conn1 , Reason1_1 ]),
@@ -893,7 +870,7 @@ temporary_queue_after_partition_recovery_2(Config, QueueDeclare) ->
893870 after Timeout ->
894871 ct :fail (" Connection ~p still running" , [Conn1 ])
895872 end ,
896- ct :pal (" Wait for queue DOWN" ),
873+ ct :pal (" Wait for queue 1 DOWN" ),
897874 receive
898875 {'DOWN' , QMRef1 , _ , _ , Reason1_2 } ->
899876 ct :pal (" Queue ~p exited: ~p " , [QPid1 , Reason1_2 ]),
@@ -903,19 +880,35 @@ temporary_queue_after_partition_recovery_2(Config, QueueDeclare) ->
903880 ct :fail (" Queue ~p still running" , [QPid1 ])
904881 end ,
905882
906- % % The first queue was deleted from the metadata store on all nodes.
907- lists :foreach (
908- fun (Node ) ->
909- ? awaitMatch (
910- {error , not_found },
911- begin
912- Ret = rabbit_ct_broker_helpers :rpc (
913- Config , Node , rabbit_amqqueue , lookup , [QName1 ]),
914- ct :pal (" Queue lookup on node ~0p : ~p " , [Node , Ret ]),
915- Ret
916- end , Timeout )
917- end , Nodes ),
883+ % % We sleep to let the queue record deletion reach the timeout. It should
884+ % % retry indefinitely.
885+ KhepriTimeout = rabbit_ct_broker_helpers :rpc (
886+ Config , Node2 , khepri_app , get_default_timeout , []),
887+ ct :pal (" Sleep > ~b ms" , [KhepriTimeout ]),
888+ timer :sleep (KhepriTimeout + 10000 ),
889+
890+ % % The queue process exited but the queue record should still be there. The
891+ % % temporary process is still trying to delete it but can't during the
892+ % % network partition.
893+ ? awaitMatch (
894+ {ok , _ },
895+ begin
896+ Ret = rabbit_ct_broker_helpers :rpc (
897+ Config , Node2 , rabbit_amqqueue , lookup , [QName1 ]),
898+ ct :pal (" Queue lookup on node ~0p : ~p " , [Node2 , Ret ]),
899+ Ret
900+ end , Timeout ),
918901
902+ % % Close the second consuming client to trigger the queue deletion during
903+ % % the network partition. This time, the partition is solved while the
904+ % % queue process tries to delete the record.
905+ ct :pal (" Close connection 2" ),
906+ _ = spawn (fun () ->
907+ rabbit_ct_client_helpers :close_connection_and_channel (
908+ Conn2 , Ch2 )
909+ end ),
910+
911+ ct :pal (" Wait for connection 2 DOWN" ),
919912 receive
920913 {'DOWN' , CMRef2 , _ , _ , Reason2_1 } ->
921914 ct :pal (" Connection ~p exited: ~p " , [Conn2 , Reason2_1 ]),
@@ -924,6 +917,7 @@ temporary_queue_after_partition_recovery_2(Config, QueueDeclare) ->
924917 after Timeout ->
925918 ct :fail (" Connection ~p still running" , [Conn2 ])
926919 end ,
920+ ct :pal (" Wait for queue 2 DOWN" ),
927921 receive
928922 {'DOWN' , QMRef2 , _ , _ , Reason2_2 } ->
929923 ct :pal (" Queue ~p exited: ~p " , [QPid2 , Reason2_2 ]),
@@ -933,6 +927,41 @@ temporary_queue_after_partition_recovery_2(Config, QueueDeclare) ->
933927 ct :fail (" Queue ~p still running" , [QPid2 ])
934928 end ,
935929
930+ % % Again, the queue process exited but the queue record should still be
931+ % % there. The temporary process is still trying to delete it but can't
932+ % % during the network partition.
933+ ? awaitMatch (
934+ {ok , _ },
935+ begin
936+ Ret = rabbit_ct_broker_helpers :rpc (
937+ Config , Node2 , rabbit_amqqueue , lookup , [QName2 ]),
938+ ct :pal (" Queue lookup on node ~0p : ~p " , [Node2 , Ret ]),
939+ Ret
940+ end , Timeout ),
941+
942+ % % We resolve the network partition.
943+ lists :foreach (
944+ fun (Node ) ->
945+ ct :pal (" Allow traffic with ~s " , [Node ]),
946+ rabbit_ct_broker_helpers :allow_traffic_between (
947+ Node2 , Node )
948+ end , Majority ),
949+ ct :pal (" Cluster status" ),
950+ clustering_utils :assert_cluster_status ({Nodes , Nodes }, Nodes ),
951+
952+ % % The first queue was deleted from the metadata store on all nodes.
953+ lists :foreach (
954+ fun (Node ) ->
955+ ? awaitMatch (
956+ {error , not_found },
957+ begin
958+ Ret = rabbit_ct_broker_helpers :rpc (
959+ Config , Node , rabbit_amqqueue , lookup , [QName1 ]),
960+ ct :pal (" Queue lookup on node ~0p : ~p " , [Node , Ret ]),
961+ Ret
962+ end , Timeout )
963+ end , Nodes ),
964+
936965 % % The second queue was deleted from the metadata store on all nodes.
937966 lists :foreach (
938967 fun (Node ) ->
0 commit comments