Skip to content

Commit 58d835b

Browse files
committed
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.
1 parent 2c96bcc commit 58d835b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

deps/rabbitmq_mqtt/test/auth_SUITE.erl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ client_id_propagation(Config) ->
526526
rpc(Config, 0, rabbit_auth_backend_mqtt_mock, setup, [Self])
527527
end),
528528
%% the setup process will notify us
529-
receive
530-
ok -> ok
529+
SetupProcess = receive
530+
{ok, SP} -> SP
531531
after
532532
3000 -> ct:fail("timeout waiting for rabbit_auth_backend_mqtt_mock:setup/1")
533533
end,
@@ -561,7 +561,11 @@ client_id_propagation(Config) ->
561561
VariableMap = maps:get(variable_map, TopicContext),
562562
?assertEqual(ClientId, maps:get(<<"client_id">>, VariableMap)),
563563

564-
ok = emqtt:disconnect(C).
564+
ok = emqtt:disconnect(C),
565+
566+
SetupProcess ! stop,
567+
568+
ok.
565569

566570
%% These tests try to cover all operations that are listed in the
567571
%% table in https://www.rabbitmq.com/access-control.html#authorisation

deps/rabbitmq_mqtt/test/rabbit_auth_backend_mqtt_mock.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
setup(CallerPid) ->
2323
ets:new(?MODULE, [set, public, named_table]),
24-
CallerPid ! ok,
24+
CallerPid ! {ok, self()},
2525
receive
2626
stop -> ok
2727
end.

0 commit comments

Comments
 (0)