Merge pull request #13367 from thalesmg/20240628-r57-test-flaky-authz-cache

test(authz cache): attempt to fix flaky test
This commit is contained in:
Thales Macedo Garitezi 2024-07-02 09:14:06 -03:00 committed by GitHub
commit 5a0bae2318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

View File

@ -37,7 +37,7 @@ end_per_suite(Config) ->
%%--------------------------------------------------------------------
t_cache_exclude(_) ->
ClientId = <<"test-id1">>,
ClientId = atom_to_binary(?FUNCTION_NAME),
{ok, Client} = emqtt:start_link([{clientid, ClientId}]),
{ok, _} = emqtt:connect(Client),
{ok, _, _} = emqtt:subscribe(Client, <<"nocache/+/#">>, 0),
@ -47,11 +47,12 @@ t_cache_exclude(_) ->
emqtt:stop(Client).
t_clean_authz_cache(_) ->
{ok, Client} = emqtt:start_link([{clientid, <<"emqx_c">>}]),
ClientId = atom_to_binary(?FUNCTION_NAME),
{ok, Client} = emqtt:start_link([{clientid, ClientId}]),
{ok, _} = emqtt:connect(Client),
{ok, _, _} = emqtt:subscribe(Client, <<"t2">>, 0),
emqtt:publish(Client, <<"t1">>, <<"{\"x\":1}">>, 0),
ClientPid = find_client_pid(<<"emqx_c">>),
ClientPid = find_client_pid(ClientId),
Caches = list_cache(ClientPid),
ct:log("authz caches: ~p", [Caches]),
?assert(length(Caches) > 0),
@ -60,11 +61,12 @@ t_clean_authz_cache(_) ->
emqtt:stop(Client).
t_drain_authz_cache(_) ->
{ok, Client} = emqtt:start_link([{clientid, <<"emqx_c">>}]),
ClientId = atom_to_binary(?FUNCTION_NAME),
{ok, Client} = emqtt:start_link([{clientid, ClientId}]),
{ok, _} = emqtt:connect(Client),
{ok, _, _} = emqtt:subscribe(Client, <<"t2">>, 0),
emqtt:publish(Client, <<"t1">>, <<"{\"x\":1}">>, 0),
ClientPid = find_client_pid(<<"emqx_c">>),
ClientPid = find_client_pid(ClientId),
Caches = list_cache(ClientPid),
ct:log("authz caches: ~p", [Caches]),
?assert(length(Caches) > 0),