Skip to content

Commit

Permalink
MQTT auth_SUITE: synchronise concurrent setup with the test
Browse files Browse the repository at this point in the history
(cherry picked from commit e8fccba)
  • Loading branch information
michaelklishin committed Jan 13, 2021
1 parent edf9122 commit 370643a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion deps/rabbitmq_mqtt/test/auth_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,17 @@ client_id_propagation(Config) ->
rabbit_auth_backend_mqtt_mock),
%% setup creates the ETS table required for the mqtt auth mock
%% it blocks indefinitely so we need to spawn
Self = self(),
_ = spawn(fun () ->
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_auth_backend_mqtt_mock,
setup,
[])
[Self])
end),
%% the setup process will notify us
receive
ok -> ok
after 3000 -> ok
end,
ClientId = <<"client-id-propagation">>,
{ok, C} = connect_user(<<"client-id-propagation">>, <<"client-id-propagation">>,
Config, ClientId),
Expand Down
5 changes: 3 additions & 2 deletions deps/rabbitmq_mqtt/test/rabbit_auth_backend_mqtt_mock.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
-behaviour(rabbit_authn_backend).
-behaviour(rabbit_authz_backend).

-export([setup/0,
-export([setup/1,
user_login_authentication/2, user_login_authorization/2,
check_vhost_access/3, check_resource_access/4, check_topic_access/4,
state_can_expire/0,
get/1]).

setup() ->
setup(CallerPid) ->
ets:new(?MODULE, [set, public, named_table]),
CallerPid ! ok,
receive
stop -> ok
end.
Expand Down

0 comments on commit 370643a

Please sign in to comment.