MQTT auth_SUITE: terminate setup process

Configuring the mock authentication backend blocks
and generates an error in the test process when the
broker goes down. The error report makes the test fail
in some environments.

The process where the setup takes place must stay up
otherwise the ETS table used will go away.

This commit makes sure the broker-side authentication backend
setup returns at the end of the test. This way the calling
process terminates in a normal way.
This commit is contained in:
Arnaud Cogoluègnes 2024-07-17 15:36:20 +02:00
parent 2c96bccc08
commit 58d835ba5d
No known key found for this signature in database
GPG Key ID: D5C8C4DFAD43AFA8
2 changed files with 8 additions and 4 deletions

View File

@ -526,8 +526,8 @@ client_id_propagation(Config) ->
rpc(Config, 0, rabbit_auth_backend_mqtt_mock, setup, [Self])
end),
%% the setup process will notify us
receive
ok -> ok
SetupProcess = receive
{ok, SP} -> SP
after
3000 -> ct:fail("timeout waiting for rabbit_auth_backend_mqtt_mock:setup/1")
end,
@ -561,7 +561,11 @@ client_id_propagation(Config) ->
VariableMap = maps:get(variable_map, TopicContext),
?assertEqual(ClientId, maps:get(<<"client_id">>, VariableMap)),
ok = emqtt:disconnect(C).
ok = emqtt:disconnect(C),
SetupProcess ! stop,
ok.
%% These tests try to cover all operations that are listed in the
%% table in https://www.rabbitmq.com/access-control.html#authorisation

View File

@ -21,7 +21,7 @@
setup(CallerPid) ->
ets:new(?MODULE, [set, public, named_table]),
CallerPid ! ok,
CallerPid ! {ok, self()},
receive
stop -> ok
end.