1818
1919-include_lib (" eunit/include/eunit.hrl" ).
2020-include_lib (" common_test/include/ct.hrl" ).
21+ -include_lib (" eunit/include/eunit.hrl" ).
2122-include_lib (" kernel/include/file.hrl" ).
2223-include_lib (" amqp_client/include/amqp_client.hrl" ).
2324
@@ -42,7 +43,11 @@ groups() ->
4243 log_management , % % Check log files.
4344 log_file_initialised_during_startup ,
4445 log_file_fails_to_initialise_during_startup ,
45- externally_rotated_logs_are_automatically_reopened % % Check log files.
46+ externally_rotated_logs_are_automatically_reopened , % % Check log files.
47+ exchange_count ,
48+ queue_count ,
49+ connection_count ,
50+ connection_lookup
4651 ]}
4752 ].
4853
@@ -698,6 +703,44 @@ disk_monitor_enable1() ->
698703 application :set_env (rabbit , disk_monitor_failure_retry_interval , 120000 ),
699704 passed .
700705
706+ % % ---------------------------------------------------------------------------
707+ % % Count functions for management only API purposes
708+ % % ---------------------------------------------------------------------------
709+ exchange_count (Config ) ->
710+ % % Default exchanges == 7
711+ ? assertEqual (7 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_exchange , count , [])).
712+
713+ queue_count (Config ) ->
714+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
715+ {ok , Ch } = amqp_connection :open_channel (Conn ),
716+ amqp_channel :call (Ch , # 'queue.declare' { queue = <<" my-queue" >> }),
717+
718+ ? assertEqual (1 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_amqqueue , count , [])),
719+
720+ amqp_channel :call (Ch , # 'queue.delete' { queue = <<" my-queue" >> }),
721+ rabbit_ct_client_helpers :close_channel (Ch ),
722+ rabbit_ct_client_helpers :close_connection (Conn ),
723+ ok .
724+
725+ connection_count (Config ) ->
726+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
727+
728+ ? assertEqual (1 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking , count , [])),
729+
730+ rabbit_ct_client_helpers :close_connection (Conn ),
731+ ok .
732+
733+ connection_lookup (Config ) ->
734+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
735+
736+ [Connection ] = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking , list , []),
737+ ? assertMatch (Connection , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking ,
738+ lookup ,
739+ [Connection # tracked_connection .name ])),
740+
741+ rabbit_ct_client_helpers :close_connection (Conn ),
742+ ok .
743+
701744% % ---------------------------------------------------------------------------
702745% % rabbitmqctl helpers.
703746% % ---------------------------------------------------------------------------
0 commit comments