auth_SUITE: Wait for connection tracking to be up-to-date

... when testing vhost limits

[Why]
The tracking is aynchronous, thus the third MQTT connection might be
opened before the tracking is up-to-date, which the testcase doesn't
expect.
This commit is contained in:
Jean-Sébastien Pédron 2025-07-15 16:41:23 +02:00
parent 6111c277b6
commit 5aab965db4
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
1 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("rabbitmq_ct_helpers/include/rabbit_assert.hrl").
%% not defined in v3
-define(SUBACK_FAILURE, 16#80).
@ -1246,6 +1247,7 @@ vhost_connection_limit(Config) ->
{ok, _} = emqtt:connect(C1),
{ok, C2} = connect_anonymous(Config, <<"client2">>),
{ok, _} = emqtt:connect(C2),
?awaitMatch(2, count_connections_per_vhost(Config), 30000),
{ok, C3} = connect_anonymous(Config, <<"client3">>),
ExpectedError = expected_connection_limit_error(Config),
unlink(C3),
@ -1254,6 +1256,13 @@ vhost_connection_limit(Config) ->
ok = emqtt:disconnect(C2),
ok = rabbit_ct_broker_helpers:clear_vhost_limit(Config, 0, <<"/">>).
count_connections_per_vhost(Config) ->
NodeConfig = rabbit_ct_broker_helpers:get_node_config(Config, 0),
rabbit_ct_broker_helpers:rpc(
Config, 0,
rabbit_connection_tracking, count_local_tracked_items_in_vhost,
[<<"/">>]).
vhost_queue_limit(Config) ->
ok = rabbit_ct_broker_helpers:set_vhost_limit(Config, 0, <<"/">>, max_queues, 1),
{ok, C} = connect_anonymous(Config),