1717-module (unit_inbroker_non_parallel_SUITE ).
1818
1919-include_lib (" common_test/include/ct.hrl" ).
20+ -include_lib (" eunit/include/eunit.hrl" ).
2021-include_lib (" kernel/include/file.hrl" ).
2122-include_lib (" amqp_client/include/amqp_client.hrl" ).
2223
@@ -41,7 +42,11 @@ groups() ->
4142 log_management , % % Check log files.
4243 log_file_initialised_during_startup ,
4344 log_file_fails_to_initialise_during_startup ,
44- externally_rotated_logs_are_automatically_reopened % % Check log files.
45+ externally_rotated_logs_are_automatically_reopened , % % Check log files.
46+ exchange_count ,
47+ queue_count ,
48+ connection_count ,
49+ connection_lookup
4550 ]}
4651 ].
4752
@@ -686,6 +691,44 @@ disk_monitor_enable1() ->
686691 application :set_env (rabbit , disk_monitor_failure_retry_interval , 120000 ),
687692 passed .
688693
694+ % % ---------------------------------------------------------------------------
695+ % % Count functions for management only API purposes
696+ % % ---------------------------------------------------------------------------
697+ exchange_count (Config ) ->
698+ % % Default exchanges == 7
699+ ? assertEqual (7 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_exchange , count , [])).
700+
701+ queue_count (Config ) ->
702+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
703+ {ok , Ch } = amqp_connection :open_channel (Conn ),
704+ amqp_channel :call (Ch , # 'queue.declare' { queue = <<" my-queue" >> }),
705+
706+ ? assertEqual (1 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_amqqueue , count , [])),
707+
708+ amqp_channel :call (Ch , # 'queue.delete' { queue = <<" my-queue" >> }),
709+ rabbit_ct_client_helpers :close_channel (Ch ),
710+ rabbit_ct_client_helpers :close_connection (Conn ),
711+ ok .
712+
713+ connection_count (Config ) ->
714+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
715+
716+ ? assertEqual (1 , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking , count , [])),
717+
718+ rabbit_ct_client_helpers :close_connection (Conn ),
719+ ok .
720+
721+ connection_lookup (Config ) ->
722+ Conn = rabbit_ct_client_helpers :open_connection (Config , 0 ),
723+
724+ [Connection ] = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking , list , []),
725+ ? assertMatch (Connection , rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_connection_tracking ,
726+ lookup ,
727+ [Connection # tracked_connection .name ])),
728+
729+ rabbit_ct_client_helpers :close_connection (Conn ),
730+ ok .
731+
689732% % ---------------------------------------------------------------------------
690733% % rabbitmqctl helpers.
691734% % ---------------------------------------------------------------------------
0 commit comments