@@ -1792,7 +1792,7 @@ dont_leak_file_handles(Config) ->
17921792 ok .
17931793
17941794grow_queue (Config ) ->
1795- [Server0 , Server1 , _Server2 , _Server3 , _Server4 ] =
1795+ [Server0 , Server1 , Server2 , _Server3 , _Server4 ] =
17961796 rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
17971797
17981798 Ch = rabbit_ct_client_helpers :open_channel (Config , Server0 ),
@@ -1825,42 +1825,72 @@ grow_queue(Config) ->
18251825
18261826 % % grow queues to node 'Server1'
18271827 TargetClusterSize_2 = 2 ,
1828- rpc :call (Server0 , rabbit_quorum_queue , grow , [Server1 , <<" /" >>, <<" .*" >>, all ]),
1828+ Result1 = rpc :call (Server0 , rabbit_quorum_queue , grow , [Server1 , <<" /" >>, <<" .*" >>, all ]),
1829+ % % [{{resource,<<"/">>,queue,<<"grow_queue">>},{ok,2}},
1830+ % % {{resource,<<"/">>,queue,<<"grow_queue_alt">>},{ok,2}},...]
1831+ ? assert (lists :all (fun ({_ , {R , _ }}) -> R =:= ok end , Result1 )),
18291832 assert_grown_queues (QQs , Server0 , TargetClusterSize_2 , MsgCount ),
18301833
18311834 % % grow queues to quorum cluster size '2' has no effect
1832- rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_2 , <<" /" >>, <<" .*" >>, all ]),
1835+ Result2 = rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_2 , <<" /" >>, <<" .*" >>, all ]),
1836+ ? assertEqual ([], Result2 ),
18331837 assert_grown_queues (QQs , Server0 , TargetClusterSize_2 , MsgCount ),
18341838
18351839 % % grow queues to quorum cluster size '3'
18361840 TargetClusterSize_3 = 3 ,
1837- rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_3 , <<" /" >>, <<" .*" >>, all ]),
1841+ Result3 = rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_3 , <<" /" >>, <<" .*" >>, all , voter ]),
1842+ ? assert (lists :all (fun ({_ , {R , _ }}) -> R =:= ok end , Result3 )),
18381843 assert_grown_queues (QQs , Server0 , TargetClusterSize_3 , MsgCount ),
18391844
18401845 % % grow queues to quorum cluster size '5'
18411846 TargetClusterSize_5 = 5 ,
1842- rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_5 , <<" /" >>, <<" .*" >>, all ]),
1847+ Result4 = rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_5 , <<" /" >>, <<" .*" >>, all , voter ]),
1848+ ? assert (lists :all (fun ({_ , {R , _ }}) -> R =:= ok end , Result4 )),
18431849 assert_grown_queues (QQs , Server0 , TargetClusterSize_5 , MsgCount ),
18441850
1845- % % shrink all queues again
1851+ % % shrink all queues again down to 1 member
18461852 rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_quorum_queue ,
18471853 force_all_queues_shrink_member_to_current_member , []),
18481854 assert_grown_queues (QQs , Server0 , TargetClusterSize_1 , MsgCount ),
18491855
18501856 % % grow queues to quorum cluster size > '5' (limit = 5).
18511857 TargetClusterSize_10 = 10 ,
1852- rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_10 , <<" /" >>, <<" .*" >>, all ]),
1858+ Result5 = rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_10 , <<" /" >>, <<" .*" >>, all ]),
1859+ ? assert (lists :all (fun ({_ , {R , _ }}) -> R =:= ok end , Result5 )),
18531860 assert_grown_queues (QQs , Server0 , TargetClusterSize_5 , MsgCount ),
18541861
1855- % % shrink all queues again
1862+ % % shrink all queues again down to 1 member
18561863 rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_quorum_queue ,
18571864 force_all_queues_shrink_member_to_current_member , []),
18581865 assert_grown_queues (QQs , Server0 , TargetClusterSize_1 , MsgCount ),
18591866
18601867 % % attempt to grow queues to quorum cluster size < '0'.
18611868 BadTargetClusterSize = - 5 ,
18621869 ? assertEqual ({error , bad_quorum_cluster_size },
1863- rpc :call (Server0 , rabbit_quorum_queue , grow , [BadTargetClusterSize , <<" /" >>, <<" .*" >>, all ])).
1870+ rpc :call (Server0 , rabbit_quorum_queue , grow , [BadTargetClusterSize , <<" /" >>, <<" .*" >>, all ])),
1871+
1872+ % % shrink all queues again down to 1 member
1873+ rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_quorum_queue ,
1874+ force_all_queues_shrink_member_to_current_member , []),
1875+ assert_grown_queues (QQs , Server0 , TargetClusterSize_1 , MsgCount ),
1876+
1877+ % % grow queues to node 'Server1': non_voter
1878+ rpc :call (Server0 , rabbit_quorum_queue , grow , [Server1 , <<" /" >>, <<" .*" >>, all , non_voter ]),
1879+ assert_grown_queues (QQs , Server0 , TargetClusterSize_2 , MsgCount ),
1880+
1881+ % % grow queues to node 'Server2': fail, non_voters found
1882+ Result6 = rpc :call (Server0 , rabbit_quorum_queue , grow , [Server2 , <<" /" >>, <<" .*" >>, all , voter ]),
1883+ % % [{{resource,<<"/">>,queue,<<"grow_queue">>},{error, 2, {error, non_voters_found}},
1884+ % % {{resource,<<"/">>,queue,<<"grow_queue_alt">>},{error, 2, {error, non_voters_found}},...]
1885+ ? assert (lists :all (
1886+ fun ({_ , Err }) -> Err =:= {error , TargetClusterSize_2 , {error , non_voters_found }} end , Result6 )),
1887+ assert_grown_queues (QQs , Server0 , TargetClusterSize_2 , MsgCount ),
1888+
1889+ % % grow queues to target quorum cluster size '5': fail, non_voters found
1890+ Result7 = rpc :call (Server0 , rabbit_quorum_queue , grow , [TargetClusterSize_5 , <<" /" >>, <<" .*" >>, all ]),
1891+ ? assert (lists :all (
1892+ fun ({_ , Err }) -> Err =:= {error , TargetClusterSize_2 , {error , non_voters_found }} end , Result7 )),
1893+ assert_grown_queues (QQs , Server0 , TargetClusterSize_2 , MsgCount ).
18641894
18651895assert_grown_queues (Qs , Node , TargetClusterSize , MsgCount ) ->
18661896 [begin
0 commit comments