@@ -27,6 +27,7 @@ all() ->
2727groups () ->
2828 ClusterSize1Tests = [
2929 vhost_is_created_with_default_limits ,
30+ vhost_is_created_with_default_queue_type ,
3031 vhost_is_created_with_operator_policies ,
3132 vhost_is_created_with_default_user ,
3233 single_node_vhost_deletion_forces_connection_closure ,
@@ -307,13 +308,14 @@ vhost_update_default_queue_type_undefined(Config) ->
307308 VHost = <<" update-default_queue_type-with-undefined-test" >>,
308309 Description = <<" rmqfpas-105 test vhost" >>,
309310 Tags = [replicate , private ],
310- DefaultQueueType = quorum ,
311+ VhostDefaultQueueType = quorum ,
312+ NodeDefaultQueueType = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_queue_type , default_alias , []),
311313 Trace = false ,
312314 ActingUser = <<" acting-user" >>,
313315 try
314316 ? assertMatch (ok , rabbit_ct_broker_helpers :add_vhost (Config , VHost )),
315317
316- PutVhostArgs0 = [VHost , Description , Tags , DefaultQueueType , Trace , ActingUser ],
318+ PutVhostArgs0 = [VHost , Description , Tags , VhostDefaultQueueType , Trace , ActingUser ],
317319 ? assertMatch (ok ,
318320 rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_vhost , put_vhost , PutVhostArgs0 )),
319321
@@ -322,7 +324,7 @@ vhost_update_default_queue_type_undefined(Config) ->
322324 rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_vhost , put_vhost , PutVhostArgs1 )),
323325
324326 V = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_vhost , lookup , [VHost ]),
325- ? assertMatch (#{default_queue_type := DefaultQueueType }, vhost :get_metadata (V ))
327+ ? assertMatch (#{default_queue_type := NodeDefaultQueueType }, vhost :get_metadata (V ))
326328 after
327329 rabbit_ct_broker_helpers :delete_vhost (Config , VHost )
328330 end .
@@ -460,10 +462,37 @@ vhost_is_created_with_default_limits(Config) ->
460462 ? assertEqual (ok , rabbit_ct_broker_helpers :add_vhost (Config , VHost )),
461463 ? assertEqual (Limits , rabbit_ct_broker_helpers :rpc (Config , 0 ,
462464 rabbit_vhost_limit , list , [VHost ]))
465+ after
466+ rabbit_ct_broker_helpers :rpc (
467+ Config , 0 ,
468+ application , unset_env , [rabbit , default_limits ])
469+ end .
470+
471+ vhost_is_created_with_default_queue_type (Config ) ->
472+ VHost = atom_to_binary (? FUNCTION_NAME ),
473+ QName = atom_to_binary (? FUNCTION_NAME ),
474+ ? assertEqual (ok , rabbit_ct_broker_helpers :rpc (Config , 0 ,
475+ application , set_env , [rabbit , default_queue_type , rabbit_quorum_queue ])),
476+ try
477+ ? assertEqual (ok , rabbit_ct_broker_helpers :add_vhost (Config , VHost )),
478+ rabbit_ct_broker_helpers :set_full_permissions (Config , <<" guest" >>, VHost ),
479+ ? assertEqual (<<" quorum" >>, rabbit_ct_broker_helpers :rpc (Config , 0 ,
480+ rabbit_vhost , default_queue_type , [VHost ])),
481+ V = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_db_vhost , get , [VHost ]),
482+ ct :pal (" Vhost metadata: ~p " , [V ]),
483+ ? assertEqual (<<" quorum" >>, maps :get (default_queue_type , vhost :get_metadata (V ))),
484+
485+ Conn = rabbit_ct_client_helpers :open_unmanaged_connection (Config , 0 , VHost ),
486+ {ok , Chan } = amqp_connection :open_channel (Conn ),
487+ amqp_channel :call (Chan , # 'queue.declare' {queue = QName , durable = true }),
488+ QNameRes = rabbit_misc :r (VHost , queue , QName ),
489+ {ok , Q } = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_amqqueue , lookup , [QNameRes ]),
490+ ? assertMatch (rabbit_quorum_queue , amqqueue :get_type (Q )),
491+ close_connections ([Conn ])
463492 after
464493 rabbit_ct_broker_helpers :rpc (
465494 Config , 0 ,
466- application , unset_env , [rabbit , default_limits ])
495+ application , unset_env , [rabbit , default_queue_type ])
467496 end .
468497
469498vhost_is_created_with_operator_policies (Config ) ->
0 commit comments