@@ -393,21 +393,25 @@ end_per_testcase(Testcase, Config) when Testcase == ssl_user_auth_success;
393393 Testcase == ssl_user_auth_failure ;
394394 Testcase == ssl_user_vhost_not_allowed ->
395395 delete_cert_user (Config ),
396+ close_all_connections (Config ),
396397 rabbit_ct_helpers :testcase_finished (Config , Testcase );
397398end_per_testcase (TestCase , Config ) when TestCase == ssl_user_vhost_parameter_mapping_success ;
398399 TestCase == ssl_user_vhost_parameter_mapping_not_allowed ->
399400 delete_cert_user (Config ),
400401 VhostForCertUser = ? config (temp_vhost_for_ssl_user , Config ),
401402 ok = rabbit_ct_broker_helpers :delete_vhost (Config , VhostForCertUser ),
402403 ok = rabbit_ct_broker_helpers :clear_global_parameter (Config , mqtt_default_vhosts ),
404+ close_all_connections (Config ),
403405 rabbit_ct_helpers :testcase_finished (Config , TestCase );
404406end_per_testcase (user_credentials_auth , Config ) ->
405407 User = ? config (new_user , Config ),
406408 {ok ,_ } = rabbit_ct_broker_helpers :rabbitmqctl (Config , 0 , [" delete_user" , User ]),
409+ close_all_connections (Config ),
407410 rabbit_ct_helpers :testcase_finished (Config , user_credentials_auth );
408411end_per_testcase (ssl_user_vhost_parameter_mapping_vhost_does_not_exist , Config ) ->
409412 delete_cert_user (Config ),
410413 ok = rabbit_ct_broker_helpers :clear_global_parameter (Config , mqtt_default_vhosts ),
414+ close_all_connections (Config ),
411415 rabbit_ct_helpers :testcase_finished (Config , ssl_user_vhost_parameter_mapping_vhost_does_not_exist );
412416end_per_testcase (Testcase , Config ) when Testcase == port_vhost_mapping_success ;
413417 Testcase == port_vhost_mapping_not_allowed ;
@@ -417,11 +421,13 @@ end_per_testcase(Testcase, Config) when Testcase == port_vhost_mapping_success;
417421 VHost = ? config (temp_vhost_for_port_mapping , Config ),
418422 ok = rabbit_ct_broker_helpers :delete_vhost (Config , VHost ),
419423 ok = rabbit_ct_broker_helpers :clear_global_parameter (Config , mqtt_port_to_vhost_mapping ),
424+ close_all_connections (Config ),
420425 rabbit_ct_helpers :testcase_finished (Config , Testcase );
421426end_per_testcase (T = port_vhost_mapping_vhost_does_not_exist , Config ) ->
422427 User = <<" guest" >>,
423428 ok = set_full_permissions (Config , User , <<" /" >>),
424429 ok = rabbit_ct_broker_helpers :clear_global_parameter (Config , mqtt_port_to_vhost_mapping ),
430+ close_all_connections (Config ),
425431 rabbit_ct_helpers :testcase_finished (Config , T );
426432end_per_testcase (T = ssl_user_cert_vhost_mapping_takes_precedence_over_port_vhost_mapping , Config ) ->
427433 delete_cert_user (Config ),
@@ -432,6 +438,7 @@ end_per_testcase(T = ssl_user_cert_vhost_mapping_takes_precedence_over_port_vhos
432438 VHostForPortVHostMapping = ? config (temp_vhost_for_port_mapping , Config ),
433439 ok = rabbit_ct_broker_helpers :delete_vhost (Config , VHostForPortVHostMapping ),
434440 ok = rabbit_ct_broker_helpers :clear_global_parameter (Config , mqtt_port_to_vhost_mapping ),
441+ close_all_connections (Config ),
435442 rabbit_ct_helpers :testcase_finished (Config , T );
436443end_per_testcase (T , Config ) when T == queue_bind_permission ;
437444 T == queue_unbind_permission ;
@@ -459,6 +466,8 @@ end_per_testcase(T, Config) when T == queue_bind_permission;
459466 % % And provide an empty log file for the next test in this group
460467 file :write_file (? config (log_location , Config ), <<>>),
461468
469+ close_all_connections (Config ),
470+
462471 rabbit_ct_helpers :testcase_finished (Config , T );
463472
464473end_per_testcase (T , Config )
@@ -469,11 +478,17 @@ end_per_testcase(T, Config)
469478 T =:= client_id_from_cert_san_email ;
470479 T =:= client_id_from_cert_dn ->
471480 SetupProcess = ? config (mock_setup_process , Config ),
472- SetupProcess ! stop ;
481+ SetupProcess ! stop ,
482+ close_all_connections (Config );
473483
474484end_per_testcase (Testcase , Config ) ->
485+ close_all_connections (Config ),
475486 rabbit_ct_helpers :testcase_finished (Config , Testcase ).
476487
488+ close_all_connections (Config ) ->
489+ rpc (Config , 0 , rabbit_mqtt , close_local_client_connections ,
490+ [end_per_testcase ]).
491+
477492delete_cert_user (Config ) ->
478493 User = ? config (temp_ssl_user , Config ),
479494 {ok ,_ } = rabbit_ct_broker_helpers :rabbitmqctl (Config , 0 , [" delete_user" , User ]).
0 commit comments